country_names.txt is a file with multiple lines, each line containing a European country and a Asian country. Read in each line of text until there is a line with the country names.
Example line inside text file:
<td >England</td> <td>55.98</td> <td >Japan</td> <td>126.8</td></tr>
How do I use ONLY ONE regular expression to extract a European country and a Asian country from any line that contains two countries. After extracting the countries, store the European country in a list of European country names and store the Asian country in a list of Asian country names.
When all the lines have been read in, print a count of how many European countries and Asian countries have been read in.
Currently, this is what I have:
import re
with open('country_names.txt') as infile:
for line in infile:
countries = re.findall("", "", infile) # regex code inside ""s in parenthesis
european_countries = countries.group(1)
asian_countries = countries.group(2)
countries = re.findall("", "", infile), You may want to use single quotes surrounding your expression, like'", "'