Abs 获取绝对路径 func Abs(path string) (string, error) pathAbs, _ := filepath.Abs("./") fmt.Println(pathAbs) // -> c:\user\... Rel 返回一个路径的相对路径 func R...
}func(self *DirEntry)readClass(classNamestring) ([]byte, Entry,error) {//拼接类文件目录 和 类文件名// '/gyb/xxx/' + 'helloworld.class' = '/gyb/xxx/helloworld.class'fileName := filepath.Join(self.absDir, className) data, err := ioutil.ReadFile(fileName)returndata, self, err }fun...
Name = path.Base(sel2) slice2 = append(slice2, aa...) }) para = doc.AddParagraph() para.Properties().SetFirstLineIndent(0.354331 * measurement.Inch) run = para.AddRun() run.AddText(w.Txt) if len(slice2) > 0 { for _, x := range slice2 { img1, err := common.ImageFrom...
func (t *Template) ParseFiles(filenames ...string) (*Template, error) 1. 1 2 path/filepath 参考博客:Go语言学习之path/filepath包(the way to go) Ext(pathstring)string 1. 1 获取路径字符串中的文件扩展名 funcAbs(pathstring) (string,error) 1. 1 获取path 的绝对路径 3...
# a_star.py def SaveImage(self, plt): millis = int(round(time.time() * 1000)) filename = './' + str(millis) + '.png' plt.savefig(filename) def ProcessPoint(self, x, y, parent): if not self.IsValidPoint(x, y): return # Do nothing for invalid point p = point.Point(x...
_, fileName=path.Split(urlp) fmt.Printf("Review %d: %s - %s - %s\n", i, title, urlp, fileName) storeData(urlp, fileName) s.SetAttr("href", fileName) } }) doc.Find("#homepage_bottom_pager .pager a").Each(func(iint, s *goquery.Selection) { ...
func loadGoFiles(dir string, filenames ...string) ([]*innerStruct, error) { newFilenames := []string{} for _, filename := range filenames { newFilenames = append(newFilenames, path.Join(dir, filename)) } conf.CreateFromFilenames("", newFilenames...) ...
NewRouter() // http://localhost:8000/static/<filename> r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir(dir))) srv := &http.Server{ Handler: r, Addr: "127.0.0.1:8000", WriteTimeout: 15 * time.Second, ReadTimeout: 15 * time.Second, } log...
{ Level string `json:"level"` // Level 最低日志等级,DEBUG<INFO<WARN<ERROR<FATAL 例如:info-->收集info等级以上的日志 FileName string `json:"file_name"` // FileName 日志文件位置 MaxSize int `json:"max_size"` // MaxSize 进行切割之前,日志文件的最大大小(MB为单位),默认为100MB MaxAge ...
Attachfilename string AttackPath string } 发送邮件函数(其中,最需要注意的就是编码问题,程序中发送邮件还是转成了base64编码。from参数需要使用FormatAddress再次编码。附件也需要注意编码问题 ):m.SetHeader("To", emailInfo.Recipient...) // 切片可以传递给不定参数 这句代码学到了函数参数还可以这样传递...