can anyone tell me how to take continuous values separated by single space from user into a list?For example how to take 50 20 17 27 19 in a single list
Asked
Active
Viewed 57 times
-1
-
1What do you mean with *continuous*? If you want to split them, try `x.split()`. – Willem Van Onsem Jul 20 '17 at 18:26
-
Hi and welcome to Stack Overflow! Please take a time to go through the [welcome tour](https://stackoverflow.com/tour) to know your way around here (and also to earn your first badge), read how to create a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) and also check [How to Ask Good Questions](https://stackoverflow.com/help/how-to-ask) so you increase your chances to get feedback and useful answers. – DarkCygnus Jul 20 '17 at 18:27
1 Answers
0
I'd input the values as a string and then split it:
>>> lst = input("input your list: ").split()
input your list: 50 20 17 27 19
>>> lst
['50', '20', '17', '27', '19']

Mureinik
- 297,002
- 52
- 306
- 350