Convert List to Dataframe Python : data = open("state_towns.txt")
    for line in data:
        print(line)

returns the following list:

Colorado[edit]

Alamosa (Adams State College)[2]

Boulder (University of Colorado at Boulder)[12]

Durango (Fort Lewis College)[2]

Connecticut[edit]

Fairfield (Fairfield University, Sacred Heart University)

Middletown (Wesleyan University)

New Britain (Central Connecticut State University)



I want to return a dataframe with two columns, state and region, that would look like this:


	State	     Town
0	Colorado	 Auburn
1	Colorado	 Florence
2	Colorado	 Jacksonville
3   Connecticut  Fairfield
4   Connecticut  Middletown
5   Connecticut  New Britain


How do i split the list so that any line that contains '[edit]' will be added to the state column?

Also how to I delete all the text in the brackets from the town entries?

thanks
