Python[Python]フォルダコピー/削除/移動[shutilモジュール] Pythonでosモジュールを用いてフォルダのコピー/削除/移動を行うためのサンプルコード一覧 フォルダのコピー import shutil shutil.copytree('sample', 'sample2') フォルダの削除 impo...Pythonプログラミング
Python[Python]フォルダ作成/削除[osモジュール] Pythonでosモジュールを用いてフォルダの作成/削除を行うためのサンプルコード一覧 フォルダの作成 import os os.mkdir('./sample') os.makedirs('./sample/test1') os.make...Pythonプログラミング
Python[Python]ファイル書き込み[print関数] Pythonでprint関数を用いてファイル書き込みを行うためのサンプルコード一覧 基本 output = 'sample.txt' test_str = 'test' f = open(output, 'w') print(test_st...Pythonプログラミング
Python[Python]条件分岐[if文] Pythonでif文を用いて分岐処理を行うためのサンプルコード一覧 if flg = True if flg: print("True") もしくは flg = False if not flg: print("False") if...e...Pythonプログラミング
Python[Python]ファイル読み込み[readlines関数] Pythonでreadlines関数を用いてファイル書き込みを行うためのサンプルコード一覧 読み込むテキストファイル Hello World Python Test sample.txt 基本 input = 'sample.txt' f ...Pythonプログラミング