I have a comma delimited text file. The 5th field on each line contains the name and address information. The name is separated from the street information by a '¬' character. The same character also separates the city|state|zip. A sample field would be:
"¬BOL¬MICKEY M MOUSE¬123 TOMORROW LANE¬ORLANDO FL 12345-6789¬¬¬¬EOL¬"
I need to separate the name into parts and the city|state|zip into parts. However, the name may or may not have a middle initial so:
m = l[4].split("¬")
firstName, mi, lastName = m[2].split()
won't work if there is no middle initial. Also, the name of the city may or may not have spaces so:
city, state, zipCode = m[4].split()
won't work if the city is 'San Antonio' or 'Rio de Janeiro' for instance.
Bottom line, how do I parse sections of a field where the section is not always in the same format?