【发布时间】:2013-09-04 18:54:32
【问题描述】:
I'm taking an intro to python class online 该网站旨在将 input() 数据自动输入到您编写的程序中,以解决各种 Python 逻辑问题。
Please see this page to see how the online class's tool uses input entries
例如类随机输入以下内容:
30
centered
text
is
great
testing
is
great
for
python!
END
显然,我必须将 30 转换为 int。如何将其余部分转换为可用的列表或数组?
width = int(input())
lis = ['centered', 'text', 'is', 'great', 'END']
【问题讨论】:
-
我不太确定你在问什么。您将元素附加到 name.append(element) 之类的列表中。而且您似乎已经知道如何使用 input() 读取输入。那你有什么问题呢?