Created
January 31, 2023 10:33
-
-
Save ben-n93/6167647c156abc3a3cce045e16c2387e to your computer and use it in GitHub Desktop.
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
# Writing results to CSV file. | |
with open("data/horror_films.csv", "w") as file_object: | |
writer = csv.DictWriter(file_object, fieldnames=["Film", "Year released", | |
"Setting"]) | |
writer.writeheader() | |
for film in horror_films_with_states: | |
for location in film.setting: | |
writer.writerow( | |
{ | |
"Film": film.title, | |
"Year released": film.year_released, | |
"Setting": location | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment