如何让python只接受字母输入?

时间:2018-01-18 14:15:01

标签: python

我是编程的菜鸟,但我希望脚本只接受字母输入而不是数字。特别是只有一个字母。感谢

for x in range (0, 90000):
("Type alphabet") 
cha1=input()
complete = choice(list1)

if (cha1) == (complete):
            print ("Try again")


if (cha1) != (complete):
    print (complete)

1 个答案:

答案 0 :(得分:0)

if 'somestring'.isalpha():
    do_stuff()