当前位置:主页 > 软件编程 > Python代码 >

python遍历小写英文字母的方法

时间:2021-11-29 10:31:47 | 栏目:Python代码 | 点击:

在c、c++等语言中,可以用字符+1的for循环来遍历小写的26个英文字母,但是由于python语言的特殊性,通过a + 1这种代码并不能成功遍历,以下是在python中遍历英文字母的简洁代码:

import string
for word in string.lowercase:
  print word 

您可能感兴趣的文章:

相关文章