前往:获取所有数字/字母范围在两个限制之间的数字

I am new to Go. I have 2 questions:

  1. Is there a way to get all the numbers between a range in Go? I can do range(1, 10) in Python or 1 to 10 in Scala to get a range.

  2. How to get all the alphabets in go? Like Python's string.letters and string.ascii_lower.

Go doesn't provide a lot of syntactic sugar. You just have to write what those Python and Scala functions do for you.

for i := 1; i <= 10; i++ {
    fmt.Print(i)
}
for i := 'A'; i <= 'Z'; i++ {
    fmt.Printf("%c", i)
}
for i := 'a'; i <= 'z'; i++ {
    fmt.Printf("%c", i)
}

12345678910ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz

https://play.golang.org/p/SU0uFVIg0k