directory - python raw input delete the zero in the begining? -
i utilize code create directories inputs user when come in perfix 00 or 011 remove first digit , create folders names "0 , 11"
#asking inputs try: numran = int(raw_input("how many perfix want start ?\n")) except: print "perfix must number" sys.exit()
any explanation ?
this lines converts each line of input integer:
inpt = int(raw_input( "perfix %d : " % (i+1) ))
the int
function ignores leading zeros in string.
but looks leave inpt
string in case:
inpt = raw_input("perfix %d : " % (i + 1))
if want allow digits, utilize str.isdigit
.
python directory
No comments:
Post a Comment