[英]How to take multiple input in a single line in python
我為此使用列表能力:
x = [i for i in int(raw_input("Enter Input:")).split(",")]
Enter Input : 1 2 3 4 5
但這會引發錯誤:
Traceback (most recent call last):
File "python", line 1, in <module>
ValueError: invalid literal for int() with base 10: '1 2 3 4 5'
有人可以整理一下。
x = [int(i) for i in raw_input("Enter Input:").split(" ")]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.