这是find_all('a')(很长)的结果:, Cancel, Vessel Name, Timestamp, Port, Port Call type, Time Elapsed, SIDER LUCK, NOVOROSSIYSK, MILAZZO, OOCL ISTANBUL, NOVOROSSIYSK, AMBARLI, TK ROTTERDAM, NOVOROSSIYSK, DILISKELESI, SEA AEOLIS, NOVOROSSIYSK, PIRAEUS, SOLIDAT, NOVOROSSIYSK, SEVASTOPOL, OCEANPRINCESS, NOVOROSSIYSK, EREGLI, EMERALD BAY, NOVOROSSIYSK, NOVOROSSIYSK, MSC DON GIOVANNI, NOVOROSSIYSK, CONSTANTA, WADI SAFAGA, NOVOROSSIYSK, DAMIETTA
我想拉出以/en/ais/details/ships/shipid:开头的字符串,例如:
^{pr2}$
到目前为止,我已经:for i in ase: #ase is where the html is sotred
print(i.get('href')) #prints everysingle href.
简言之,我的问题是如何在不使用regex的情况下只保留具有我感兴趣的字符串的href?在