I have a file full of strings which i read into a list. Now I'd like to find a specific line (for example the first line below) by looking for .../002/... and add to these 002 +5 to give me /007/, in order to find my next line containing /007/.
The file looks like this
https://ladsweb.modaps.eosdis.nasa.gov/archive/allData/6/MYD021KM/2018/002/MYD021KM.A2018002.1345.006.2018003152137.hdf
https://ladsweb.modaps.eosdis.nasa.gov/archive/allData/6/MYD021KM/2018/004/MYD021KM.A2018004.1345.006.2018005220045.hdf
with this i could identify for example the first line:
match = re.findall("/(\d{3})/", data_time_filtered[i])
The problem now is: how do I convert the string to integers but keeping the format 00X? Is this Ansatz correct?:
match_conv = ["{WHAT's in HERE?}".format(int(i)) for i in match]
EDIT according to suggested answers below:
So apparently there's no way to directly read the numbers in the string and keep them as they are?
adding 0s to the number with zfill and other suggested functions makes it more complicated as /00x/ should remain max 3 digits (as they represent days of year). So i was looking for an efficient way to keep the numbers from the string as they are and make them "math-able".
intdoes not have a format.