File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 17
17
with open (file_path , 'a' ) as textFile :
18
18
count = 0
19
19
for biz in businesses :
20
+ first_line = ""
21
+ second_line = ""
20
22
try :
21
23
title = biz .find ('a' , {'class' : 'biz-name' }).text
22
24
address = biz .find ('address' ).contents
23
25
# print(address)
24
26
phone = biz .find ('span' , {'class' : 'biz-phone' }).text
25
27
region = biz .find ('span' , {'class' : 'neighborhood-str-list' }).contents
26
28
count += 1
27
- first_line = ""
28
- second_line = ""
29
29
for item in address :
30
30
if "br" in item :
31
31
first_line += item .getText () + " "
46
46
phone = None
47
47
region = None
48
48
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 )
51
51
52
52
try :
53
53
textFile .write (str (detail ) + '\n \n ' )
You can’t perform that action at this time.
0 commit comments