How do I iterate through the alphabet?

后端 未结 2 1928
被撕碎了的回忆
被撕碎了的回忆 2021-02-03 16:18

In Python, could I simply ++ a char? What is an efficient way of doing this?

I want to iterate through URLs that have the www.website.com/term/#, www.website.com/term/a,

2条回答
  •  抹茶落季
    2021-02-03 17:17

    You can use string.ascii_lowercase which is simply a convenience string of lowercase letters,

    >>> from string import ascii_lowercase
    >>> for c in ascii_lowercase:
    ...     # append to your url
    

提交回复
热议问题