2digits numbering for subjects
This commit is contained in:
parent
d864808774
commit
0982a21592
@ -47,12 +47,13 @@ def produce_and_compile(options):
|
|||||||
output = path(template_file.dirname()) / path(template_file.name[3:])
|
output = path(template_file.dirname()) / path(template_file.name[3:])
|
||||||
|
|
||||||
if not options.csv_file:
|
if not options.csv_file:
|
||||||
list_infos = [{"num": i+1} for i in range(options.num_subj)]
|
# {:02:0f} means that we want a 2 digits number
|
||||||
|
list_infos = [{"num": "{:02.0f}".format(i+1)} for i in range(options.num_subj)]
|
||||||
else:
|
else:
|
||||||
with open(options.csv_file, 'r', encoding = 'ISO-8859-1') as f:
|
with open(options.csv_file, 'r', encoding = 'ISO-8859-1') as f:
|
||||||
list_infos = list(csv.DictReader(f, delimiter=";"))
|
list_infos = list(csv.DictReader(f, delimiter=";"))
|
||||||
for (i,a) in enumerate(list_infos):
|
for (i,a) in enumerate(list_infos):
|
||||||
a['num'] = i+1
|
a['num'] = "{:02.0f}".format(i+1)
|
||||||
|
|
||||||
if output.dirname() != "":
|
if output.dirname() != "":
|
||||||
output.dirname().cd()
|
output.dirname().cd()
|
||||||
|
Loading…
Reference in New Issue
Block a user