I am new to Python. Is there a StringTokenizer in Python? Can I do character by character scanning and copying.
I have the following input string
data = '123:Palo Alto, CA -> 456:Seattle, WA 789'
I need to extract the two (city, state) fields from this string. Here is the code I wrote
name_list = []
while i < len(data)):
if line[i] == ':':
name = ''
j = 0
i = i + 1
while line[i] != '-' and line[i].isnumeric() == False:
name[j] = line[i] # This line gives error
i = i + 1
j = j + 1
name_list.append(name)
i = i + 1
What should I do?