Skip to content

Commit f696b4d

Browse files
committed
correct error and print detail with full address
1 parent be3394a commit f696b4d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

writing_clean_data.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
with open(file_path, 'a') as textFile:
1818
count = 0
1919
for biz in businesses:
20+
first_line = ""
21+
second_line = ""
2022
try:
2123
title = biz.find('a', {'class': 'biz-name'}).text
2224
address = biz.find('address').contents
2325
# print(address)
2426
phone = biz.find('span', {'class': 'biz-phone'}).text
2527
region = biz.find('span', {'class': 'neighborhood-str-list'}).contents
2628
count += 1
27-
first_line = ""
28-
second_line = ""
2929
for item in address:
3030
if "br" in item:
3131
first_line += item.getText() + " "
@@ -46,8 +46,8 @@
4646
phone = None
4747
region = None
4848

49-
detail = f"{title}\n{address}\n{phone}\n{region}"
50-
# print(detail)
49+
detail = f"{title}\n{second_line}\n{phone}\n"
50+
print(detail)
5151

5252
try:
5353
textFile.write(str(detail) + '\n\n')

0 commit comments

Comments
 (0)