After Python 3.0, keyboard input uses the input function
1 2 3 |
|
Nothing is displayed on the command line. After inputting 123, it is directly assigned to x and printed.
Just using input cannot solve most data processing. Usually the input string needs to be split. Python uses the split() function to split it
1 2 3 4 5 |
|
But this is still not enough. The input is Numbers, we hope that the list is also a number, so we need to further convert
1 2 3 4 5 6 7 8 |
|
The parameters of the split("") function can be any separator, including (a,b,c….;1,2,3… ;%,!,*,space)
1 2 3 4 5 6 7 8 |
|
For more Python-related technical articles, please visit the Python Tutorial column to learn!
The above is the detailed content of How to use the input function in python to input a list. For more information, please follow other related articles on the PHP Chinese website!