我是一個完整的noob在python和編程,所以我敢肯定這個問題可能會刺激一些,所以我正在閱讀這本書,它有這個例子,它不有用完raw_input
Python代碼不能運行[輸入]
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Filename: continue.py
#!/usr/bin/python
# Filename: break.py
while True:
s = (raw_input('Enter something : '))
if s == 'quit':
break
print('Length of the string is', len(s))
print('Done')
我的意思是,當我在書裏只加入input
像代碼不能運行。這是爲什麼?
你是什麼意思*「add just'input'」*?哪裏?哪個版本的Python(3.x或2.x)?這是你真正想要使用的縮進嗎? – jonrsharpe 2014-10-03 13:19:03
你的python版本是什麼? 'input()'用於python 3.x ...在終端運行這個命令'python --version'!你也有不好的縮進! – Kasramvd 2014-10-03 13:19:08