Hello,
I've tried different things, but still can't strings to always be left-padded, three-digits long even for strings that contain a dash sign:
I've tried different things, but still can't strings to always be left-padded, three-digits long even for strings that contain a dash sign:
file1 = open('input.txt', 'r') for line in file1.readlines(): #print(line.zfill(3),end='') #001 expected, 01 returned :-/ #print(line.zfill(4),end='') #doesn't work with range, eg. 30-42 passHere's the source:
1 2 3 8-10 11 12-18 88-91 92-95 96-100 101-103 112-122Thank you.