问题补充说明:如何使用raw_input 记录用户输入信息,然后将信息存入一个二位数组里 ?
record=[]
whil聚eTrue:
info=[]
userInput=raw_input('Entersomething:')
ifuserInput=="exit":
break
else:
info=userInput.split(",")
record+=[info]
printrecord
输入的时候把内容用逗号隔开.
输入exit终止循环.
Entersomething:hello,hi
Entersomething:good,bad
Entersomething:red,green
Entersomething:exit
[['hello','hi'],['good','b露够ad'],['red','green']]
>>>
标签:python
版权声明:文章由 知识问问 整理收集,来源于互联网或者用户投稿,如有侵权,请联系我们,我们会立即处理。如转载请保留本文链接:https://www.zhshwenwen.com/answer/23208.html