當我運行這個腳本時,它跳過了第8行的打印功能。我找不到爲什麼我的生活。我已經嘗試了很多東西來完成這個工作,但我似乎無法弄清楚這裏的問題。我對Python非常陌生,所以如果這是一個非常簡單的問題,請原諒我。打印在if語句中不起作用
編輯:woops,忘了實際的代碼! 捂臉那就是:
import webbrowser
import sys
b = webbrowser.get('windows-default')
print('Type start')
line1 = sys.stdin.readline()
start = 'start'
if line1 == start:
print('What website do you want to open?')
line2 = sys.stdin.readline()
b.open(line2)
看起來你忘了,包括腳本... – dano 2014-10-08 00:00:08
哈哈只要我張貼意識到這點。現在修好! – HardenedMidget 2014-10-08 00:01:57
您是否知道['raw_input'](http://docs.python.org/library/functions.html#raw_input)(或['input'](https://docs.python.org/3/library) /functions.html#input)在Python 3)?顯然你在這裏要求用戶輸入,所以最好使用這些方法而不是'sys.stdin.readline'。 – 2014-10-08 00:10:34