python - Need help splitting a string into 3 variables -


i split string of characters 3 variables. when run .split() ['aaa00000011']. split like:

var1 = aaa var2 = 0000001 var3 = 1 

the user typing in these values command line on windows machine.

my code:

barcode = raw_input('please enter barcode')  print "this barcode split up", barcode.split() 

are looking this?

var1 = barcode[:3]   # first 3 characters var2 = barcode[3:-1] # characters third next-to-last var3 = barcode[-1]   # last character 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -