Last active
April 8, 2022 11:19
-
-
Save a1exDi/a903baa11fcd5216308489c1a505bfcd to your computer and use it in GitHub Desktop.
Конвектировать csv в словарь dict python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
country | capital | |
---|---|---|
Abkhazia | Sukhumi | |
Afghanistan | Kabul | |
Akrotiri and Dhekelia | Episkopi Cantonment | |
Albania | Tirana | |
Algeria | Algiers | |
American Samoa | Pago Pago | |
Andorra | Andorra la Vella | |
Angola | Luanda | |
Anguilla | The Valley | |
Antigua and Barbuda | St. John's | |
Argentina | Buenos Aires | |
Armenia | Yerevan | |
Aruba | Oranjestad | |
Ascension Island | Georgetown | |
Australia | Canberra | |
Austria | Vienna | |
Azerbaijan | Baku | |
Bahamas | Nassau | |
Bahrain | Manama | |
Bangladesh | Dhaka | |
Barbados | Bridgetown | |
Belarus | Minsk | |
Belgium | Brussels | |
Belize | Belmopan | |
Benin | Porto-Novo | |
Bermuda | Hamilton | |
Bhutan | Thimphu | |
Bolivia | Sucre | |
Bolivia | La Paz | |
Bosnia and Herzegovina | Sarajevo | |
Botswana | Gaborone | |
Brazil | Brasília | |
British Virgin Islands | Road Town | |
Brunei | Bandar Seri Begawan | |
Bulgaria | Sofia | |
Burkina Faso | Ouagadougou | |
Burundi | Bujumbura | |
Cambodia | Phnom Penh | |
Cameroon | Yaoundé | |
Canada | Ottawa | |
Cape Verde | Praia | |
Cayman Islands | George Town | |
Central African Republic | Bangui | |
Chad | N'Djamena | |
Chile | Santiago | |
China | Beijing | |
Christmas Island | Flying Fish Cove | |
Cocos (Keeling) Islands | West Island | |
Colombia | Bogotá | |
Comoros | Moroni | |
Cook Islands | Avarua | |
Costa Rica | San José | |
Croatia | Zagreb | |
Cuba | Havana | |
Curaçao | Willemstad | |
Cyprus | Nicosia | |
Czech Republic | Prague | |
Côte d'Ivoire | Yamoussoukro | |
Democratic Republic of the Congo | Kinshasa | |
Denmark | Copenhagen | |
Djibouti | Djibouti | |
Dominica | Roseau | |
Dominican Republic | Santo Domingo | |
East Timor (Timor-Leste) | Dili | |
Easter Island | Hanga Roa | |
Ecuador | Quito | |
Egypt | Cairo | |
El Salvador | San Salvador | |
Equatorial Guinea | Malabo | |
Eritrea | Asmara | |
Estonia | Tallinn | |
Ethiopia | Addis Ababa | |
Falkland Islands | Stanley | |
Faroe Islands | Tórshavn | |
Federated States of Micronesia | Palikir | |
Fiji | Suva | |
Finland | Helsinki | |
France | Paris | |
French Guiana | Cayenne | |
French Polynesia | Papeete | |
Gabon | Libreville | |
Gambia | Banjul | |
Georgia | Tbilisi | |
Germany | Berlin | |
Ghana | Accra | |
Gibraltar | Gibraltar | |
Greece | Athens | |
Greenland | Nuuk | |
Grenada | St. George's | |
Guam | Hagåtña | |
Guatemala | Guatemala City | |
Guernsey | St. Peter Port | |
Guinea | Conakry | |
Guinea-Bissau | Bissau | |
Guyana | Georgetown | |
Haiti | Port-au-Prince | |
Honduras | Tegucigalpa | |
Hungary | Budapest | |
Iceland | Reykjavík | |
India | New Delhi | |
Indonesia | Jakarta | |
Iran | Tehran | |
Iraq | Baghdad | |
Ireland | Dublin | |
Isle of Man | Douglas | |
Israel | Jerusalem | |
Italy | Rome | |
Jamaica | Kingston | |
Japan | Tokyo | |
Jersey | St. Helier | |
Jordan | Amman | |
Kazakhstan | Astana | |
Kenya | Nairobi | |
Kiribati | Tarawa | |
Kosovo | Pristina | |
Kuwait | Kuwait City | |
Kyrgyzstan | Bishkek | |
Laos | Vientiane | |
Latvia | Riga | |
Lebanon | Beirut | |
Lesotho | Maseru | |
Liberia | Monrovia | |
Libya | Tripoli | |
Liechtenstein | Vaduz | |
Lithuania | Vilnius | |
Luxembourg | Luxembourg | |
Macedonia | Skopje | |
Madagascar | Antananarivo | |
Malawi | Lilongwe | |
Malaysia | Kuala Lumpur | |
Maldives | Malé | |
Mali | Bamako | |
Malta | Valletta | |
Marshall Islands | Majuro | |
Mauritania | Nouakchott | |
Mauritius | Port Louis | |
Mexico | Mexico City | |
Moldova | Chisinau | |
Monaco | Monaco | |
Mongolia | Ulaanbaatar | |
Montenegro | Podgorica | |
Montserrat | Plymouth | |
Morocco | Rabat | |
Mozambique | Maputo | |
Myanmar | Naypyidaw | |
Nagorno-Karabakh Republic | Stepanakert | |
Namibia | Windhoek | |
Nauru | Yaren | |
Nepal | Kathmandu | |
Netherlands | Amsterdam | |
New Caledonia | Nouméa | |
New Zealand | Wellington | |
Nicaragua | Managua | |
Niger | Niamey | |
Nigeria | Abuja | |
Niue | Alofi | |
Norfolk Island | Kingston | |
North Korea | Pyongyang | |
Northern Cyprus | Nicosia | |
United Kingdom Northern Ireland | Belfast | |
Northern Mariana Islands | Saipan | |
Norway | Oslo | |
Oman | Muscat | |
Pakistan | Islamabad | |
Palau | Ngerulmud | |
Palestine | Jerusalem | |
Panama | Panama City | |
Papua New Guinea | Port Moresby | |
Paraguay | Asunción | |
Peru | Lima | |
Philippines | Manila | |
Pitcairn Islands | Adamstown | |
Poland | Warsaw | |
Portugal | Lisbon | |
Puerto Rico | San Juan | |
Qatar | Doha | |
Republic of China (Taiwan) | Taipei | |
Republic of the Congo | Brazzaville | |
Romania | Bucharest | |
Russia | Moscow | |
Rwanda | Kigali | |
Saint Barthélemy | Gustavia | |
Saint Helena | Jamestown | |
Saint Kitts and Nevis | Basseterre | |
Saint Lucia | Castries | |
Saint Martin | Marigot | |
Saint Pierre and Miquelon | St. Pierre | |
Saint Vincent and the Grenadines | Kingstown | |
Samoa | Apia | |
San Marino | San Marino | |
Saudi Arabia | Riyadh | |
Scotland | Edinburgh | |
Senegal | Dakar | |
Serbia | Belgrade | |
Seychelles | Victoria | |
Sierra Leone | Freetown | |
Singapore | Singapore | |
Sint Maarten | Philipsburg | |
Slovakia | Bratislava | |
Slovenia | Ljubljana | |
Solomon Islands | Honiara | |
Somalia | Mogadishu | |
Somaliland | Hargeisa | |
South Africa | Pretoria | |
South Georgia and the South Sandwich Islands | Grytviken | |
South Korea | Seoul | |
South Ossetia | Tskhinvali | |
South Sudan | Juba | |
Spain | Madrid | |
Sri Lanka | Sri Jayawardenapura Kotte | |
Sudan | Khartoum | |
Suriname | Paramaribo | |
Swaziland | Mbabane | |
Sweden | Stockholm | |
Switzerland | Bern | |
Syria | Damascus | |
São Tomé and Príncipe | São Tomé | |
Tajikistan | Dushanbe | |
Tanzania | Dodoma | |
Thailand | Bangkok | |
Togo | Lomé | |
Tonga | Nukuʻalofa | |
Transnistria | Tiraspol | |
Trinidad and Tobago | Port of Spain | |
Tristan da Cunha | Edinburgh of the Seven Seas | |
Tunisia | Tunis | |
Turkey | Ankara | |
Turkmenistan | Ashgabat | |
Turks and Caicos Islands | Cockburn Town | |
Tuvalu | Funafuti | |
Uganda | Kampala | |
Ukraine | Kiev | |
United Arab Emirates | Abu Dhabi | |
United Kingdom; England | London | |
United States | Washington, D.C. | |
United States Virgin Islands | Charlotte Amalie | |
Uruguay | Montevideo | |
Uzbekistan | Tashkent | |
Vanuatu | Port Vila | |
Vatican City | Vatican City | |
Venezuela | Caracas | |
Vietnam | Hanoi | |
Wales | Cardiff | |
Wallis and Futuna | Mata-Utu | |
Western Sahara | El Aaiún | |
Yemen | Sanaá | |
Zambia | Lusaka | |
Zimbabwe | Harare |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# конвектировать csv в словарь python | |
import csv | |
with open('country_capital.csv', newline='') as csvfile: | |
reader = csv.DictReader(csvfile) | |
for row in reader: | |
print(row['country'], row['capital']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment