在使用下面的代碼:使用IF/ELIF /別的一個「開關」,在蟒蛇
url = None
print("For 'The Survey of Cornwall,' press 1")
print("For 'The Adventures of Sherlock Holmes,' press 2")
print("For 'Pride and Prejudice,' press 3")
n = input("Which do you choose?")
if n==1:
url = 'http://www.gutenberg.org/cache/epub/9878/pg9878.txt' #cornwall
print("cornwall")
elif n==2:
url = 'http://www.gutenberg.org/cache/epub/1661/pg1661.txt' #holmes
print("holmes)
elif n==3:
url = 'http://www.gutenberg.org/cache/epub/1342/pg1342.txt' #pap
print("PaP")
else:
print("That was not one of the choices")
我只得到了「其他」的情況下退換,那爲什麼可能?
python版本? – 2013-05-12 04:26:18
另外,''holmes'後面還有一個引用,只是讓你知道, – 2013-05-12 04:28:03