Home  >  Article  >  Backend Development  >  Python implements inputting multiple values ​​in one line

Python implements inputting multiple values ​​in one line

不言
不言Original
2018-04-21 14:22:146723browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn