1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

python3の標準入力で、1行で複数データを入力する方法

Posted at

Python3の標準有力を複数列で入力する方法です。
個数が2個の場合を例にしています。


s = input().split()
print(s[0])
print(s[1])

になります。文字列型とint型とデータ型が異なる場合は


s = input().split()
print(s[0])
print(int(s[1]))

になります。参考にしていただけると幸いです。

1
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?