8000 add MAX_DIGIT_LEN · mz09code/leetcode@48a562c · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 48a562c

Browse files
committed
add MAX_DIGIT_LEN
1 parent 849cd54 commit 48a562c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

leetcode_generate.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from collections import namedtuple, OrderedDict
2121

2222
HOME = Path.cwd()
23+
MAX_DIGIT_LEN = 4 # 1000+ PROBLEMS
2324
SOLUTION_FOLDER_NAME = 'solutions'
2425
SOLUTION_FOLDER = Path.joinpath(HOME, SOLUTION_FOLDER_NAME)
2526
CONFIG_FILE = Path.joinpath(HOME, 'config.cfg')
@@ -466,7 +467,7 @@ def _download_code_by_quiz(self, quiz):
466467
)
467468
return
468469

469-
qname = '{id}-{title}'.format(id=str(qid).zfill(3), title=qtitle)
470+
qname = '{id}-{title}'.format(id=str(qid).zfill(MAX_DIGIT_LEN), title=qtitle)
470471
print('begin download ' + qname)
471472
path = Path.joinpath(SOLUTION_FOLDER, qname)
472473
check_and_make_dir(path)
@@ -555,7 +556,7 @@ def write_readme(self):
555556
if item.solutions:
556557
dirname = '{folder}/{id}-{title}'.format(
557558
folder=SOLUTION_FOLDER_NAME,
558-
id=str(item.question_id).zfill(3),
559+
id=str(item.question_id).zfill(MAX_DIGIT_LEN),
559560
title=item.question__title_slug,
560561
)
561562
language = ''

0 commit comments

Comments
 (0)
0