11 lines
391 B
Python
11 lines
391 B
Python
# Считаем количество букв в названиях городов
|
|
with open('cities.txt', 'r', encoding='utf-8') as f:
|
|
cities = f.readlines()
|
|
|
|
with open('result.txt', 'w', encoding='utf-8') as f:
|
|
for city in cities:
|
|
city = city.strip()
|
|
if city:
|
|
f.write(f"{city} -> {len(city)} букв\n")
|
|
|
|
print("Готово! Смотри result.txt") |