0
0

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.

pyhon標準入力一覧表

0
Last updated at Posted at 2021-04-21

 はじめに

なんども標準入力の方法を検索して中々覚えることができないので、自分へのメモ書きとしてpythonの標準入力を書き留めました。
※随時加筆していく予定

1行に数字が一つ

入力例
5

n = int(input())

1行に数字が2つ以上で、別々に受け取る場合

入力例
4 5

A,B = map(int, input().split())

1行に空白区切りで、数字が2つ以上あり、リストとして受け取る場合

入力例
4 5

A = list(map(int,input().split()))

複数行の入力があり、終了文字に指定があるとき

:例 終了文字が0
2
5
17
4
8
14
0

x = []
while True:
    n = int(input())
    if n == 0:
        break
    x.append(n)
0
0
2

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?