C言語で scanf のようなものを作るには、python では input() で実現できる。
例
print('xの値を入力してください')
x = input()
print('xの値は ' + x)
結果
xの値を入力してください 234 xの値は 234
雑記
投稿日:2020年11月28日 更新日:
C言語で scanf のようなものを作るには、python では input() で実現できる。
print('xの値を入力してください')
x = input()
print('xの値は ' + x)
xの値を入力してください 234 xの値は 234
執筆者:seyanen
関連記事
python3 で、pathlib を使ってファイルの拡張子を取得する方法
pathlib モジュールの stem を使う。 この書き方は、python 3.4 以降で使えるようになった。 https://docs.python.org/3/library/pathlib.h …
python3 で、csv ファイルを読み込んで条件をみたす行の内容を表示する方法
csv.reader で読み込み、各行を読み込んで判定する。 例 import csv with open(‘data.csv’, ‘r’) as csv_file: reader = csv.rea …
readline を使って次のように書く。 例 ファイル:data.txt # id name age 1 佐藤太郎 10 2 鈴木花子 18 3 坂本明美 21 4 松村光子 24 5 小川奏子 1 …
2023/01/18
matplotlib のグラフ作成と gnuplot との対応 比較
2022/10/14
pythonで配列(リスト)の、ある要素がわかっているときにその次の要素を取得する方法。