python如何反复获取用户的输入并将这些输入保存在list中,小弟初学者,每次无法获取第二个输入(泪)

zhishi=' '

while zhishi!='quit':
zhishi=raw_input('please give me the command\n')
list=zhishi.split()

def add():
print 'add'

def remove():
print 'remove'

if list[0]=='a':
add()
break
if list[0]=='r':
remove()
break
被人鄙视所以重发改好缩进的版本
flag=True

while flag:
zhishi=raw_input('please give me the command\n')
list=zhishi.split()

def add():
print 'add a street'

def remove():
print 'remove a street'

if list[0]=='a':
add()
break
if list[0]=='r':
remove()
break

第1个回答  2015-09-27

你自己都知道缩进有问题,那就把缩进改好了再发上来,

#!/usr/bin python
#coding=utf-8

print '百度知道上的提问者连代码都不会发吗?'
print '问个问题连正确,详细的描述问题都不会吗?'

本回答被网友采纳
相似回答