首页 > 解决方案 > 损坏的 HTML 标签 - BeautifulSoup

问题描述

下面的代码完美地从这个网站上抓取数据,除了一些包含在损坏的 HTML 或不同标签中的记录。此外,某些名称的首字母没有出现,例如此页面上的 Cyclect Electrical Engineering Pte Ltd 如何解决此问题以使所有名称正确显示:-

import requests 
from bs4 import BeautifulSoup
import re

urls = []
for i in range(14,25):
    pages = "http://www.asmi.com/index.cfm?GPID={0}".format(i)
    urls.append(pages)
for info in urls:
    entry=[]
    page = requests.get(info)
    soup = BeautifulSoup(page.content, 'html5lib')
    text = [' '.join(items.split()) for items in soup(text =re.compile(r"Ltd$"))]
    print(text)

我得到的输出是

['ASL Shipyard Pte Ltd', 'Damen Shipyards Singapore Pte Ltd', 'DDW-PaxOcean Shipyard Pte Ltd', 'Dundee Marine & Industrial Services Pte Ltd', 'Dyna-Mac Engineering Services Pte Ltd', 'Five Aluminium Boat & Engineering Pte Ltd', 'Keppel FELS Ltd', 'Keppel Offshore & Marine Ltd', 'Keppel Shipyard Ltd', 'Keppel Singmarine Pte Ltd', 'Kim Heng Marine & Oilfield Pte Ltd', 'Kim Seah Boat Builders Pte Ltd', 'Kwong Soon Engineering Co. (Pte) Ltd', 'Pandan Shipyard Pte Ltd', 'Penguin International Ltd', 'Sembcorp Marine Ltd', 'Sembcorp Marine Integrated Yard Pte Ltd', 'Sembcorp Marine Offshore Platforms Pte Ltd', 'Sembcorp Marine Repairs & Upgrades Pte Ltd', 'Sembcorp Marine Specialised Shipbuilding Pte Ltd', 'ST Engineering Marine Ltd', 'Strategic Marine (S) Pte Ltd', 'YTC Shipyard Pte Ltd']
['edge Technologies Pte Ltd', 'yclect Electrical Engineering Pte Ltd', 'Engie Axima Singapore Pte Ltd', '& Hopman Engineering Pte Ltd', 'OceanMaster Engineering Pte Ltd', 'Sindex Refrigeration Pte Ltd', 'Viking Engineering Pte Ltd']
[]
['Aedge Technologies Pte Ltd', 'Allbest Marine Engineering Pte Ltd', 'Atwin Marine Engineering Pte Ltd', 'Chugoku Marine Paints (S) Pte Ltd', 'Drew Ameriod (S) Pte Ltd', 'Hempel (Singapore) Pte Ltd', 'Hypex Engineering & Services Pte Ltd', 'ternational Paint Singapore Pte Ltd', 'LNT Coating Pte Ltd', 'PPG Coatings (Singapore) Pte Ltd', 'Viking Engineering Pte Ltd']
['edge Technologies Pte Ltd', 'Alphatron Marine Systems Pte Ltd', 'Codar (Pte) Ltd', 'Emerson Process Management Marine Solutions Singapore Pte Ltd', 'Furuno Singapore Pte Ltd', 'Jason Electronics (Pte) Ltd', 'Kongsberg Maritime Pte Ltd', 'Singapore Telecommunications Ltd', 'STSTC Pte Ltd', 'SWTS Pte Ltd']
['QA Systems Pte Ltd', 'Rigging & Marine Services Pte Ltd', 'Royscan Engineering Pte Ltd', 'Weldtech Inspection Services (S) Pte Ltd']
['ABB Pte Ltd', 'Aedge Technologies Pte Ltd', 'Alfa Laval Singapore Pte Ltd', 'Allbest Marine Engineering Pte Ltd', 'Alpine Engineering Services Pte Ltd', 'Apbco Offshore & Marine Pte Ltd', 'Atwin Marine Engineering Pte Ltd', 'Brightsun Marine Pte Ltd', 'Candid Marine Engineering Pte Ltd', 'Crestchic (Asia-Pacific) Pte Ltd', 'Cutech Solutions & Services Pte Ltd', 'Cyclect Electrical Engineering Pte Ltd', 'Devcon Enterprises Pte Ltd', 'yna-Mac Engineering Services Pte Ltd', 'EELAT Pte Ltd', 'Singapore Pte Ltd', 'Eng Soon Investment Pte Ltd', 'Five Aluminium Boat & Engineering Pte Ltd', 'Foo Ngan Marine Pte Ltd', 'Foster Asia Pacific Pte Ltd', 'obal Offshore & Marine Pte Ltd', 'Goltens Singapore Pte Ltd', 'Great Sun Offshore Pte Ltd', 'Heatec JieTong Pte Ltd', 'HongRong Engineering Pte Ltd', 'Hoo Huat Engineering Pte Ltd', 'Hup Hoe Engineering Pte Ltd', 'Hypex Engineering & Services Pte Ltd', 'Index-Cool Marine & Industry Pte Ltd', 'Jemix Engineering Pte Ltd', 'Johnson Controls (S) Pte Ltd', 'Keppel Sea Scan Pte Ltd', 'Kim Heng Marine & Oilfield Pte Ltd', 'Kim Seah Boat Builders Pte Ltd', 'Kok & Chan Marine Services Pte Ltd', 'K S Automation Pte Ltd', 'Kwong Soon Engineering Co. (Pte) Ltd', 'Lam Heng Marine Pte Ltd', 'LPJ Marine Services Pte Ltd', 'Major Engineering and Technology Pte Ltd', 'Mantech Engineering Pte Ltd', 'Maritime Associates Pte Ltd', 'Mectrade Engineering Pte Ltd', 'Megawatts Engineering Services Pte Ltd', 'Mencast Holdings Ltd', 'Mentrade Marine Engineering Pte Ltd', 'New & Novel Engineering Pte Ltd', 'OceanMaster Engineering Pte Ltd', 'Onda Industries Engineering Marine Pte Ltd', 'QA Systems Pte Ltd', 'Rolls-Royce Singapore Pte Ltd', 'Royscan Engineering Pte Ltd', 'Seagull Pte Ltd', 'Seah Marine Engineering Pte Ltd', 'SeaTech Solutions International (S) Pte Ltd', 'Sentek Marine & Trading Pte Ltd', 'Siong Leng Engineering Pte Ltd', 'Sparrows Offshore Services (Singapore) Pte Ltd', 'SPCO Holdings Pte Ltd', 'Straits Innovation Pte Ltd', 'Star-Ray Pte Ltd', 'Ta-Ching Marine Technology Pte Ltd', 'Tech-Growth Engineering Pte Ltd', 'Tech Offshore Marine (S) Pte Ltd', 'Tru-Marine Pte Ltd', 'Viking Engineering Pte Ltd', 'Vita Enterprises Pte Ltd', 'Vosper Naval Systems Pte Ltd', 'Wah Soon Marine Pte Ltd', 'Yanmar Asia (S) Corporation Pte Ltd', 'Yong Cheong Marine & Engineering Pte Ltd']
['Caterpillar Marine Asia Pacific Pte Ltd', 'Chong Lee Leong Seng Co Ltd', 'Cinta Asia (Singapore) Pte Ltd', 'Cummins Sales and Service Singapore Pte Ltd', 'Daikai Engineering Pte Ltd', 'Harris Pye Singapore Pte Ltd', 'Junma Services Pte Ltd', 'Kwong Soon Engineering Co. (Pte) Ltd', 'MAN Energy Solutions Singapore Pte Ltd', 'MTU Asia Pte Ltd', 'Power Diesel Engineering Pte Ltd', 'Rolls-Royce Singapore Pte Ltd', 'Stewart Engineering Works (S) Pte Ltd', 'Tractors Singapore Ltd', 'Tru-Marine Pte Ltd', 'Wartsila Singapore Pte Ltd', 'West Marine Engineering Pte Ltd', 'Xin Ming Hua Pte Ltd', 'Yanmar Asia (S) Corporation Pte Ltd']
['ABB Pte Ltd', 'Pte Ltd', 'Atlas Marine Services Pte Ltd', 'eng Hui Marine Electrical Pte Ltd', 'Best Technology Pte Ltd', 'hong Lee Leong Seng Co Ltd', 'Cinta Asia (Singapore) Pte Ltd', 'Daikai Engineering Pte Ltd', 'Drew Ameriod (S) Pte Ltd', 'Emerson Process Management Marine Solutions Singapore Pte Ltd', 'Engtek Pte Ltd', 'ERIKS Pte Ltd', 'ESAB Asia/Pacific Pte Ltd', 'Excel Marco Singapore Pte Ltd', 'Fassmer Singapore Pte Ltd', 'Finetek Pte Ltd', 'Flotech Controls Pte Ltd', 'Franklin Offshore International Pte Ltd', 'Global Marine Safety (Singapore) Pte Ltd', 'Griffin Group International Pte Ltd', 'Griffin Kinetic Pte Ltd', 'Harris Pye Singapore Pte Ltd', 'Hup Hoe Engineering Pte Ltd', 'HydroPro Pte Ltd', 'ICF International Pte Ltd', 'Industmarine Engineers Pte Ltd', 'Invertek Drives Far East Pte Ltd', 'Kelvin Hughes (Singapore) Pte Ltd', 'Keppel Sea Scan Pte Ltd', 'Kheng Cheong Co Pte Ltd', 'KM Kinley Marketing Pte Ltd', 'Kongsberg Maritime Pte Ltd', 'Kwong Soon Engineering Co. (Pte) Ltd', 'acGregor Pte Ltd', 'Marinelec Technologies Asia Pte Ltd', 'Mencast Subsea Pte Ltd', 'MTU Asia Pte Ltd', 'Niigata Power Systems (Singapore) Pte Ltd', 'Nordic Flow Control Pte Ltd', 'OceanMaster Engineering Pte Ltd', 'Omega Pro Tech (1996) Pte Ltd', 'lfinger Asia Pacific Pte Ltd', 'Pamarine Pte Ltd', 'PH Hydraulics & Engineering Pte Ltd', 'Poclain Hydraulics Pte Ltd', 'K Instruments (S) Pte Ltd', 'Rapid Marine HVAC (Asia-Pacific) Pte Ltd', 'Reintjes Asia Pacific Pte Ltd', 'Robert Bosch (South East Asia) Pte Ltd', 'Scanjet Asia Pacific Pte Ltd', 'Scanvik Marine Services Pte Ltd', 'Schottel Far East (Pte) Ltd', 'Seaquest Enterprise Pte Ltd', 'Seng Heng Engineering Pte Ltd', 'SES Marine Services Pte Ltd', 'Singapore Cables Manufacturers Pte Ltd', 'SL Metals Pte Ltd', 'Sparrows Offshore Services (Singapore) Pte Ltd', 'Springer-EMS Pte Ltd', 'Teho International Inc Ltd', 'Tractors Singapore Ltd', 'Trans-Asiatic Trading Pte Ltd', 'Transvictory Winch System Pte Ltd', 'Turbo Solutions Pte Ltd', 'alves & Piping Asia Pte Ltd', 'Viking Engineering Pte Ltd', 'Wartsila Pumps Pte Ltd', 'Xin Ming Hua Pte Ltd', 'Z-Power Automation Pte Ltd', 'ZF Asia Pacific Pte Ltd']
['Aedge Technologies Pte Ltd', 'Any Mari Scaffolding Pte Ltd', 'HHE Scaffold Pte Ltd', 'Hoo Huat Engineering Pte Ltd', 'Multiheight Scaffolding Pte Ltd', 'Singa Marine Scaffolding Pte Ltd']
['Aedge Technologies Pte Ltd', 'Apbco Offshore & Marine Pte Ltd', 'ASL Solutions Pte Ltd', 'Astoria Solutions Pte Ltd', 'CESCO Environmental Technologies Pte Ltd', 'Cutech Solutions & Services Pte Ltd', 'Ecospec Global Technology Pte Ltd', 'Global Fire Solution Pte Ltd', 'Griffin Kinetic Pte Ltd', 'Kim Heng Marine & Oilfield Pte Ltd', 'M3 Marine Group Pte Ltd', 'Maritime Associates Pte Ltd', 'NSL OilChem Waste Management Pte Ltd', 'NYK ShipManagement Pte Ltd', 'ower Systech Pte Ltd', 'Rubicon Offshore International Pte Ltd', 'Seaquest Enterprise Pte Ltd', 'Sentek Marine & Trading Pte Ltd', 'The National Forwarder (S) Pte Ltd', 'Vision Global Engineering & Safety Services Pte Ltd']

任何投入将不胜感激 !!

标签: python-3.xweb-scrapingbeautifulsoup

解决方案


import requests
from bs4 import BeautifulSoup
import re


for num in range(14, 25):
    r = requests.get(f"http://www.asmi.com/index.cfm?GPID={num}")
    soup = BeautifulSoup(r.text, 'html.parser')
    names = list(dict.fromkeys([' '.join(items.split())
                                for items in soup(text=re.compile(r'Ltd\s?$'))]))
    print(names)

您的假设是错误的,每个名称都以Ltd.

如果您查看第 14 页的来源

您实际上缺少 2 个公司名称,并且肯定也缺少其他页面:

Crestsa Marine & Offshore Pte Ltd 
MMA Offshore Shipyard and Engineering Services Pte Ltd 

如果您确实查看了第一家公司的来源:

<a name="C"></a>Crestsa Marine &amp; Offshore Pte Ltd&nbsp;<br />

&nbsp;是不可破坏的空间ASCII 160

因此Ltd$正则表达式将不匹配,因为你Ltd\xa0在最后

所以 withr'Ltd\s?$'现在是固定的。

输出:

['ASL Shipyard Pte Ltd', 'Crestsa Marine & Offshore Pte Ltd', 'Damen Shipyards Singapore Pte Ltd', 'DDW-PaxOcean Shipyard Pte Ltd', 'Dundee Marine & Industrial Services Pte Ltd', 'Dyna-Mac Engineering Services Pte Ltd', 'Five Aluminium Boat & Engineering Pte Ltd', 'Keppel FELS Ltd', 'Keppel Offshore & Marine Ltd', 'Keppel Shipyard Ltd', 'Keppel Singmarine Pte Ltd', 'Kim Heng Marine & Oilfield Pte Ltd', 'Kim Seah Boat Builders Pte Ltd', 'Kwong Soon Engineering Co. (Pte) Ltd', 'MA Offshore Shipyard and Engineering Services Pte Ltd', 'Pandan Shipyard Pte Ltd', 'Penguin International Ltd', 'Sembcorp Marine Ltd', 'Sembcorp Marine Integrated Yard Pte Ltd', 'Sembcorp Marine Offshore Platforms Pte Ltd', 'Sembcorp Marine Repairs & Upgrades Pte Ltd', 'Sembcorp Marine Specialised Shipbuilding Pte Ltd', 'ST Engineering Marine Ltd', 'Strategic Marine (S) Pte Ltd', 'YTC Shipyard Pte Ltd']
['edge Technologies Pte Ltd', 'yclect Electrical Engineering Pte Ltd', 'Engie Axima 
Singapore Pte Ltd', '& Hopman Engineering Pte Ltd', 'OceanMaster Engineering Pte Ltd', 'Sindex Refrigeration Pte Ltd', 'Viking Engineering Pte Ltd']
['Marine (Singapore) Pte Ltd', 'Singapore Pte Ltd', 'RINA Hong Kong Ltd']
['Aedge Technologies Pte Ltd', 'Allbest Marine Engineering Pte Ltd', 'Atwin Marine Engineering Pte Ltd', 'Chugoku Marine Paints (S) Pte Ltd', 'Drew Ameriod (S) Pte Ltd', 'Hempel (Singapore) Pte Ltd', 'Hypex Engineering & Services Pte Ltd', 'ternational Paint Singapore Pte Ltd', 'LNT Coating Pte Ltd', 'PPG Coatings (Singapore) Pte Ltd', 'Viking Engineering Pte Ltd']
['edge Technologies Pte Ltd', 'Alphatron Marine Systems Pte Ltd', 'Codar (Pte) Ltd', 'Emerson Process Management Marine Solutions Singapore Pte Ltd', 'Furuno Singapore 
Pte Ltd', 'Jason Electronics (Pte) Ltd', 'Kongsberg Maritime Pte Ltd', 'Masstron Pte Ltd', 'Modern Automation & Engineering Pte Ltd', 'Singapore Telecommunications Ltd', 'STSTC Pte Ltd', 'SWTS Pte Ltd']
['QA Systems Pte Ltd', 'Rigging & Marine Services Pte Ltd', 'Royscan Engineering Pte Ltd', 'Weldtech Inspection Services (S) Pte Ltd']
['ABB Pte Ltd', 'Aedge Technologies Pte Ltd', 'Alfa Laval Singapore Pte Ltd', 'Allbest Marine Engineering Pte Ltd', 'Alpine Engineering Services Pte Ltd', 'Apbco Offshore & Marine Pte Ltd', 'Arc Marine Engineering Pte Ltd', 'Atwin Marine Engineering Pte Ltd', 'Brightsun Marine Pte Ltd', 'Candid Marine Engineering Pte Ltd', 'Crestchic 
(Asia-Pacific) Pte Ltd', 'Cutech Solutions & Services Pte Ltd', 'Cyclect Electrical 
Engineering Pte Ltd', 'Devcon Enterprises Pte Ltd', 'yna-Mac Engineering Services Pte Ltd', 'EELAT Pte Ltd', 'Singapore Pte Ltd', 'Eng Soon Investment Pte Ltd', 'Five Aluminium Boat & Engineering Pte Ltd', 'Foo Ngan Marine Pte Ltd', 'Foster Asia Pacific Pte Ltd', 'obal Offshore & Marine Pte Ltd', 'Goltens Singapore Pte Ltd', 'Great Sun Offshore Pte Ltd', 'Harris Pye Singapore Pte Ltd', 'Heatec JieTong Pte Ltd', 'HongRong Engineering Pte Ltd', 'Hoo Huat Engineering Pte Ltd', 'Hup Hoe Engineering Pte 
Ltd', 'Hypex Engineering & Services Pte Ltd', 'Index-Cool Marine & Industry Pte Ltd', 'Japan Marine United Singapore Pte Ltd', 'Jemix Engineering Pte Ltd', 'Johnson Controls (S) Pte Ltd', 'Keppel Sea Scan Pte Ltd', 'Kim Heng Marine & Oilfield Pte Ltd', 'Kim Seah Boat Builders Pte Ltd', 'Kok & Chan Marine Services Pte Ltd', 'K S Automation Pte Ltd', 'Kwong Soon Engineering Co. (Pte) Ltd', 'Lal Offshore Marine Pte Ltd', 'Lam Heng Marine Pte Ltd', 'LPJ Marine Services Pte Ltd', 'Major Engineering and Technology Pte Ltd', 'Mantech Engineering Pte Ltd', 'Maritime Associates Pte Ltd', 'Mectrade Engineering Pte Ltd', 'Megawatts Engineering Services Pte Ltd', 'Mencast Holdings Ltd', 'Mentrade Marine Engineering Pte Ltd', 'MR Marine Engineering Pte Ltd', 
'MTQ Engineering Pte Ltd', 'New & Novel Engineering Pte Ltd', 'OceanMaster Engineering Pte Ltd', 'Onda Industries Engineering Marine Pte Ltd', 'Promor Pte Ltd', 'QA Systems Pte Ltd', 'Rolls-Royce Singapore Pte Ltd', 'Royscan Engineering Pte Ltd', 'Seagull Pte Ltd', 'Seah Marine Engineering Pte Ltd', 'SeaTech Solutions International (S) Pte Ltd', 'Sentek Marine & Trading Pte Ltd', 'Siemens Pte Ltd', 'Siong Leng Engineering Pte Ltd', 'SMIT Singapore Pte Ltd', 'Sparrows Offshore Services (Singapore) Pte Ltd', 'SPCO Holdings Pte Ltd', 'Straits Innovation Pte Ltd', 'Star-Ray Pte Ltd', 'SWTS Pte Ltd', 'Ta-Ching Marine Technology Pte Ltd', 'Tech-Growth Engineering Pte Ltd', 'Tech Offshore Marine (S) Pte Ltd', 'Tru-Marine Pte Ltd', 'Viking Engineering Pte Ltd', 'Vita Enterprises Pte Ltd', 'Vosper Naval Systems Pte Ltd', 'Wah Soon Marine Pte Ltd', 'Welmet Engineering Pte Ltd', 'Yanmar Asia (S) Corporation Pte Ltd', 'Yong Cheong Marine & Engineering Pte Ltd']
['Caterpillar Marine Asia Pacific Pte Ltd', 'Chong Lee Leong Seng Co Ltd', 'Cinta Asia (Singapore) Pte Ltd', 'Cummins Sales and Service Singapore Pte Ltd', 'Daikai Engineering Pte Ltd', 'Harris Pye Singapore Pte Ltd', 'Japan Marine United Singapore Pte Ltd', 'Junma Services Pte Ltd', 'Kwong Soon Engineering Co. (Pte) Ltd', 'MAN Energy Solutions Singapore Pte Ltd', 'MTU Asia Pte Ltd', 'Power Diesel Engineering Pte Ltd', 'Rolls-Royce Singapore Pte Ltd', 'Stewart Engineering Works (S) Pte Ltd', 'Tractors Singapore Ltd', 'Tru-Marine Pte Ltd', 'Wartsila Singapore Pte Ltd', 'West Marine 
Engineering Pte Ltd', 'Xin Ming Hua Pte Ltd', 'Yanmar Asia (S) Corporation Pte Ltd']
['ABB Pte Ltd', 'Aflex Ships Equipment Pte Ltd', 'Pte Ltd', 'Atlas Marine Services Pte Ltd', 'eng Hui Marine Electrical Pte Ltd', 'Best Technology Pte Ltd', 'Bloomfoss 
Pte Ltd', 'hong Lee Leong Seng Co Ltd', 'Cinta Asia (Singapore) Pte Ltd', 'Crestsa Marine & Offshore Pte Ltd', 'Daikai Engineering Pte Ltd', 'Drew Ameriod (S) Pte Ltd', 'Emerson Process Management Marine Solutions Singapore Pte Ltd', 'Engtek Pte Ltd', 
'ERIKS Pte Ltd', 'ESAB Asia/Pacific Pte Ltd', 'Excel Marco Singapore Pte Ltd', 'Fassmer Singapore Pte Ltd', 'Finetek Pte Ltd', 'Flotech Controls Pte Ltd', 'Franklin Offshore International Pte Ltd', 'Gardyon Pte Ltd', 'Global Marine Safety (Singapore) Pte Ltd', 'Griffin Group International Pte Ltd', 'Griffin Kinetic Pte Ltd', 'Harris Pye Singapore Pte Ltd', 'Hup Hoe Engineering Pte Ltd', 'HydroPro Pte Ltd', 'ICF International Pte Ltd', 'Industmarine Engineers Pte Ltd', 'Invertek Drives Far East Pte Ltd', 'Japan Marine United Singapore Pte Ltd', 'Kelvin Hughes (Singapore) Pte Ltd', 'Keppel Sea Scan Pte Ltd', 'Kheng Cheong Co Pte Ltd', 'KM Kinley Marketing Pte Ltd', 
'Kongsberg Maritime Pte Ltd', 'KTL Offshore Pte Ltd', 'Kwong Soon Engineering Co. (Pte) Ltd', 'acGregor Pte Ltd', 'Marinelec Technologies Asia Pte Ltd', 'Mencast Subsea Pte Ltd', 'MEP Deck Solutions Pte Ltd', 'Mooreast Asia Pte Ltd', 'MTU Asia Pte Ltd', 'Niigata Power Systems (Singapore) Pte Ltd', 'Nordic Flow Control Pte Ltd', 'OceanMaster Engineering Pte Ltd', 'Omega Pro Tech (1996) Pte Ltd', 'lfinger Asia Pacific 
Pte Ltd', 'Pamarine Pte Ltd', 'PH Hydraulics & Engineering Pte Ltd', 'Poclain Hydraulics Pte Ltd', 'K Instruments (S) Pte Ltd', 'Rapid Marine HVAC (Asia-Pacific) Pte Ltd', 'Reintjes Asia Pacific Pte Ltd', 'Robert Bosch (South East Asia) Pte Ltd', 'Scanjet Asia Pacific Pte Ltd', 'Scanvik Marine Services Pte Ltd', 'Schottel Far East (Pte) Ltd', 'Seaquest Enterprise Pte Ltd', 'Seng Heng Engineering Pte Ltd', 'Sensitron 
Singapore (Sensing) Pte Ltd', 'SES Marine Services Pte Ltd', 'Singapore Cables Manufacturers Pte Ltd', 'SL Metals Pte Ltd', 'Sparrows Offshore Services (Singapore) Pte 
Ltd', 'Springer-EMS Pte Ltd', 'Tat Wai Enterprise Pte Ltd', 'Teho International Inc 
Ltd', 'Tractors Singapore Ltd', 'Trans-Asiatic Trading Pte Ltd', 'Transvictory Winch System Pte Ltd', 'Tri-Star Industries Pte Ltd', 'Turbo Solutions Pte Ltd', 'Uniclimb Services Pte Ltd', 'alves & Piping Asia Pte Ltd', 'Viking Engineering Pte Ltd', 'Wartsila Pumps Pte Ltd', 'Xin Ming Hua Pte Ltd', 'Z-Power Automation Pte Ltd', 'ZF Asia Pacific Pte Ltd']
['Aedge Technologies Pte Ltd', 'Any Mari Scaffolding Pte Ltd', 'HHE Scaffold Pte Ltd', 'Hoo Huat Engineering Pte Ltd', 'Multiheight Scaffolding Pte Ltd', 'Singa Marine 
Scaffolding Pte Ltd']
['Aedge Technologies Pte Ltd', 'Apbco Offshore & Marine Pte Ltd', 'ASL Solutions Pte Ltd', 'Astoria Solutions Pte Ltd', 'CESCO Environmental Technologies Pte Ltd', 'Crestsa Marine & Offshore Pte Ltd', 'Cutech Solutions & Services Pte Ltd', 'Ecospec Global Technology Pte Ltd', 'Global Fire Solution Pte Ltd', 'Griffin Kinetic Pte Ltd', 
'Kim Heng Marine & Oilfield Pte Ltd', 'M3 Marine Group Pte Ltd', 'Maritime Associates Pte Ltd', 'Mosestide Pte Ltd', 'NSL OilChem Waste Management Pte Ltd', 'NYK ShipManagement Pte Ltd', 'ower Systech Pte Ltd', 'Rubicon Offshore International Pte Ltd', 'Seaquest Enterprise Pte Ltd', 'Sentek Marine & Trading Pte Ltd', 'Sinwa (Singapore) Pte Ltd', 'Six Tee Engineering Groups Pte Ltd', 'The National Forwarder (S) Pte Ltd', 'Vision Global Engineering & Safety Services Pte Ltd']

关于你关于名字的问题Cyclect Electrical Engineering Pte Ltd

实际上,来源包括以下内容

yclect Electrical Engineering Pte Ltd

关于这封信C,它在以下内容中:

<span style="font-size: small;">
<strong>C</strong>

我注意到您只选择了以结尾的公司,Ltd但也有其他公司。我相信你试过了,但实际上这个网站完全是螃蟹!

但你可以使用类似的东西来错过。

    other = list(dict.fromkeys([items.text
                                for items in soup.findAll("strong", text=True)]))
    print(names+other)

推荐阅读