Oct-06-2022, 05:39 AM
Hi Team,
Need help for converting all ID no into minimum 3 digit. pythonic way.
Check the id no, if id is single digit, add two zeros infront of it.
if id is double digit, add one zeros infront of it.
if id is >=3. no prefix required.
below is rough sketch
Need help for converting all ID no into minimum 3 digit. pythonic way.
Check the id no, if id is single digit, add two zeros infront of it.
if id is double digit, add one zeros infront of it.
if id is >=3. no prefix required.
below is rough sketch
forcast_id = 1 if forecast_id == 1: forcast_id = "001" #single digit value prefix 00 to it (0-9) print(forcast_id) if forecast_id == 11: forcast_id = "011" #double digit value prefix 0 to it ( 11 - 99) print(forcast_id) if forecast_id >= 100: forcast_id = 100 or max id print(forcast_id)