LoginSignup
0
0

More than 1 year has passed since last update.

Python備忘録

Posted at

ファイル操作

ディレクトリ・ファイルが存在するか
os.path.exists
ディレクトリが存在するか
os.path.isdir
ディレクトリを再帰的に作成
os.makedirs('dirname', exist_ok=True)

numpy

保存・読み出し

numpy配列を保存
np.save("dir",arr)
numpy配列を読み込み
np.load("dir")

型を指定してnumpy配列を作成
np.array(arr, dtype="")
numpy配列を型キャスト
[ndarray].astype([dtype])

matplotlib

保存・読み出し

numpy配列を画像として保存
plt.imsave("dir", arr)

0
0
0

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