Created
December 29, 2020 13:18
-
-
Save kotoripiyopiyo/8be3c80f61fc70aad50e69d14bc6a119 to your computer and use it in GitHub Desktop.
連番ファイルを作る
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! python3 | |
# 連番ファイルを作る | |
import os | |
# 連番のリストを作る | |
numbering_files = [f'sample{i:03d}.txt' for i in range(1,21)] | |
# ディレクトリを作り、基本のパスを決める | |
os.mkdir('./numbering') | |
path = './numbering' | |
# 連番ファイルを作る | |
for i in numbering_files: | |
file = open(os.path.join(path, i), 'w') | |
file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment