小编use*_*560的帖子

如何在Python 3.2中选择输入

input("Would you like to read: comedy, political, philisophical, or tragedy?")

a = "comedy"
b = "political"
c = "philisophical"
d = "tragedy"

if a:
    input("Would you like the author's nationality to be: English or French?")
    e = "French"
    d = "English"
    if e:
        print("Tartuffe")
    elif d:
        print("Taming of the Shrew")
Run Code Online (Sandbox Code Playgroud)

当我运行该程序时,默认为喜剧,然后是Tartuffe.
如何让它识别字符串中的差异类型?

python string input

2
推荐指数
1
解决办法
953
查看次数

标签 统计

input ×1

python ×1

string ×1