a

Python terminal memo

Mac

terminalでバージョン確認

python

Pythonを終了する

exit()    # ctrl + d

ファイルの実行

python {ファイル名}.py

コマンドライン引数

コマンドライン

python test.py a b 10

python

import sys

args = sys.argv

print(args)
# ['test.py', 'a', 'b', 'c']  # 第0引数はファイル名
print("第1引数:" + args[1])
# 第1引数:a
print("第2引数:" + args[2])
# 第2引数:b
print("第3引数:" + args[3])
# 第3引数:10  # string

Jupyter Notebook を起動する

jupyter notebook