-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.py
82 lines (57 loc) · 2.03 KB
/
script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import csv
extracted_museums = []
flag = print("""
## ##########
## ##########
## ##########
## ##########
""")
with open('Museer, landsdel-gizem.csv', 'r') as csv_file:
csv_reader = csv.DictReader(csv_file, delimiter=';')
for row in csv_reader:
extracted_row = {
'Landsdel': row['Landsdel'],
'Museumskategori': row['Museumskategori'],
'Museumsnavn': row['Museumsnavn']
}
extracted_museums.append(extracted_row)
# Print the extracted data
#for row in extracted_museums:
#print(row)
#print(type(extracted_museums))
#type()
def greet():
print("Welcome To Museum Crawler of Denmark 🇩🇰")
print("We are here to help you get most out of cultural layer of Denmark")
regions = []
for i in extracted_museums:
region = list(i.values())[0]
regions.append(region)
unique_regions = list(set(regions))
#first_letter_region =
#print(unique_regions)
def choose_region():
regions_list = "\n".join(unique_regions)
print(f"Before we start, a quick reminder of Museum Regions of Denmark:\n{regions_list}")
selected_region = input("In which region do you want to see the museum:")
museums_in_selected_region = []
for museum in extracted_museums:
if museum['Landsdel'] == selected_region:
museums_in_selected_region.append(museum['Museumsnavn'])
if museums_in_selected_region:
print(f"Museums in {selected_region}:")
for museum_name in museums_in_selected_region:
print(museum_name)
else:
print(f"No museums found in the selected region: {selected_region}")
#def choose_region():
#regions_list = "\n".join(unique_regions)
#print(f"Before we start, a quick reminder of Museum Regions of Denmark:\n{regions_list}")
#first_question = input("In which region do you want to see the museum:")
#if first_question in regions:
#print(extracted_museums['Museumsnavn'])
#choose_region()
def museum_crawler():
greet()
choose_region()
museum_crawler()