Skip to content
4 hidden cells
1 hidden cell
Postal monitir
import requests
from bs4 import BeautifulSoupurl = "https://www.postcrossing.com/postal-monitor"response = requests.get(url)soup = BeautifulSoup(response.content)restriction_country = "Belarus"country_ids = {}
for country in soup.findAll("details"):
key = country.get('id')
value = country.i.get('title').replace(' flag', '')
country_ids[key] = value
country_idsresult = []
for key, value in country_ids.items():
tmp = soup.findAll("details", {"id": key})
if restriction_country in tmp[0].text:
result.append(value)
result.remove(restriction_country)resultlen(result)50, 48!, 49, 50, 49, 51, 53
4 hidden cells
Hidden code
1 hidden cell
r2 = set(list_53).difference(set(list_49))
print(r2)