|
24 | 24 | phone = biz.find('span', {'class': 'biz-phone'}).text
|
25 | 25 | region = biz.find('span', {'class': 'neighborhood-str-list'}).contents
|
26 | 26 | count += 1
|
| 27 | + first_line = "" |
| 28 | + second_line = "" |
27 | 29 | for item in address:
|
28 | 30 | if "br" in item:
|
29 | | - print(item.getText()) |
| 31 | + first_line+=item.getText()+" " |
30 | 32 | else:
|
31 | | - print('\n'+ item.strip(" \n\r\t")) |
| 33 | + second_line+= item.strip(" \n\r\t")+" " |
32 | 34 | for item in region:
|
33 | 35 | if "br" in item:
|
34 | | - print(item.getText()) |
| 36 | + first_line+=item.getText()+" " |
35 | 37 | else:
|
36 | | - print(item.strip(" \n\t\r") + '\n') |
| 38 | + second_line+=item.strip(" \n\t\r") + " " |
37 | 39 |
|
38 | 40 | except Exception as e:
|
39 | 41 | print(e)
|
|
0 commit comments