package main import ( "fmt" "strings" "time" ) func main() { str := "#" str = strings.Repeat(str, 50) i := 0 for i <= 100 { s := str[:i/2] s1 := fmt.Sprintf("%5v%s", i, "%") fmt.Printf("\r%-50v%s", s, s1) time.Sleep(100 * time.Millisecond) i++ } time.Sleep(1 * time.Second) fmt.Printf("\r%100v\r", "") }
标签:Repeat,进度条,golang,str,main,strings From: https://www.cnblogs.com/lqq2314/p/16894806.html