Skip to content

Instantly share code, notes, and snippets.

@kotoripiyopiyo
Created December 29, 2020 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kotoripiyopiyo/8be3c80f61fc70aad50e69d14bc6a119 to your computer and use it in GitHub Desktop.
Save kotoripiyopiyo/8be3c80f61fc70aad50e69d14bc6a119 to your computer and use it in GitHub Desktop.
連番ファイルを作る
#! 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