I want to dynamically concat strings contained in a list dynamically using python but i've run into an error with my logic.
The goal is to concat the strings until an occurence of a string that starts with a digit is found, then isolating this digit string into its own variable and then isolating the remaining strings into a third variable.
For example:
stringList = ["One", "Two", "Three", "456", "Seven", "Eight", "Nine"] resultOne = "OneTwoThree" resultTwo = "456" resultThree = "SevenEightNine" Here's what i've tried:
stringList = ["One", "Two", "Three", "456", "Seven", "Eight", "Nine"] i = 0 stringOne = "" stringTwo = "" stringThree = "" refStart = 1 for item in stringList: if stringList[i].isdigit() == False: stringOne += stringList[i] i += 1 print(stringOne) elif stringList[i].isdigit == True: stringTwo += stringList[i] i += 1 print(stringTwo) refStart += i else: for stringList[refStart] in stringList: stringThree += stringList[refStart] refStart + 1 += i print(stringThree) It errors out with the following message:
File "c:\folder\Python\Scripts\test.py", line 19 refStart + 1 += i ^ SyntaxError: 'operator' is an illegal expression for augmented assignment