Python implements inputting multiple values ​​in one line

不言
Release: 2018-04-21 14:22:14
Original
6743 people have browsed it

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())
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template