leetcode icon indicating copy to clipboard operation
leetcode copied to clipboard

Add leading zeros to file name to keep them in order

Open abe-101 opened this issue 4 years ago • 2 comments

A neat little python script can add leading zero's to all the file names this way they will appear in order. Something like this:

import sys,os,re

for file in sys.argv[1:]:
    if __file__ in file: continue
    number, name = file.split('-', 1)
    number = '{:0>4}'.format(number)
    new_name = f'{number}-{name}'
    os.rename(file,new_name)

PR #335 is the result of the above program.

abe-101 avatar Jul 12 '22 01:07 abe-101

It's worth noting that this is very closely related to #457. They should probably be part of the same proposal since they both require the website to be updated.

flonle avatar Jul 27 '22 16:07 flonle

Thanks for the suggestion @abe-101 !

We'll include this as part of the work for #457. Closing out in favor of tracking there

mitchellirvin avatar Aug 31 '22 23:08 mitchellirvin