Home > Article > Backend Development > Python implements inputting multiple values in one line
The following is a Python method for inputting multiple values in one line. It has a good reference value and I hope it will be helpful to everyone. Let's come and take a look
#How does python realize the input of multiple values in one line?
For example, read two numbers 10 23 into a b.
It’s very simple a,b = input().split().
Of course, what is stored in a and b are strings.
If you require integers to be stored in a and b, you can write like this
a,b = map(int,input().split())
Related recommendations:
Python implements finding the longest non-repeating substring for a given string
The above is the detailed content of Python implements inputting multiple values in one line. For more information, please follow other related articles on the PHP Chinese website!