I am trying to separate my wordlist for a school project, the list is Country:Population
China:1382323332
India:1326801576
USA:324118787
Indonesia:260581100
and so on...
i have done this code Warning its messy and there are some duplicates:
Data = open("CountryList.txt","r")
DATA = Data.readlines()
file = "CountryList.txt"
Test = open(file,'r')
for x in range(0,len(DATA)):
for lines in Test.readlines():
Country,Population = lines.split(':')
print(Country)
print(Population)
the result is:
Egypt
93383574
Egypt
93383574
Egypt
93383574
for 13x more
I want this to put the Country in a Country list and the Population in a Population List so the result would be
USA
324118787
China
1382323332
How can I achieve this?