We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 57d47c5 commit 3d2d7f2Copy full SHA for 3d2d7f2
restaurant_names.py
@@ -5,7 +5,7 @@
5
city = "los angeles"
6
7
8
-with open('los_angeles_restaurants.txt', 'w') as file:
+with open('los_angeles_restaurants.txt', 'a') as file:
9
start = 0
10
for i in range(100):
11
url = base_url.format(city, start)
@@ -19,9 +19,12 @@
19
20
count = 0
21
for info in names:
22
- title = info.text.encode("utf-8")
23
- print(title)
24
- count += 1
25
- file.write(title + '\n')
26
- print(f"{count} RESTAURANTS FOUND...")
+ try:
+ title = info.text
+ print(title)
+ file.write(title + '\n')
+ count += 1
27
+ except Exception as e:
28
+ print(e)
29
+ print(f"{count} RESTAURANTS EXTRACTED...")
30
print(start)
0 commit comments