Skip to content

Commit

Permalink
Update python script to add padding on csv filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
zeddo123 committed May 7, 2023
1 parent 2545fc4 commit efcf5e3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions generate_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@
if not os.path.exists("csvset"):
os.makedirs("csvset")

padding_file = len(str(NUMBER_OF_FILES))
padding_line = len(str(NUMBER_OF_LINES))

for i in tqdm(range(NUMBER_OF_FILES)):
with open(f'csvset/{i}.csv', 'w') as f:
filename = str(i).zfill(padding_file)
with open(f'csvset/{filename}.csv', 'w') as f:
uppercase = list(ascii_uppercase[:cols])
f.write(','.join(uppercase))
f.write('\n')
for l in range(NUMBER_OF_LINES):
f.write(','.join(f'{letter}{l}' for letter in uppercase))
l_str = str(l).zfill(padding_line)
f.write(','.join(f'{filename}{letter}{l_str}' for letter in uppercase))
f.write('\n')

0 comments on commit efcf5e3

Please sign in to comment.