How to split an 8 character string into groups of two in python -
this question has answer here:
- split string every nth character? 15 answers
looking split simple string of 8 random digits:
mystring = "08928192"
so read as:
mystringx = "08" mystringy = "92" mystringa = "81" mystringb = "92"
looking method simple follow , gives me these strings shown. number generated random.rand_range() function earlier own. need arises need way randomly define objects map co-ordinates , 2 other properties( going health , size) resource-management style game working on. rest of code easy enough, part stumped me.
many archangelarchitect
mystring = "08928192" n = 2 output = [mystring[i:i+n] in range(0, len(mystring), n)] print(output)
Comments
Post a Comment