我的功能可以让我从我的网站获取所有标题我不想从某些产品中获取标题这是正确的方法吗?我不想要带有“OLP NL”或“Arcserve”或“LicSAPk”或“symantec”字样的产品标题
def get_title ( u ):
html = requests.get ( u )
bsObj = BeautifulSoup ( html.content, 'xml' )
title = str ( bsObj.title ).replace ( '<title>', '' ).replace ( '</title>',
'' )
if (title.find ( 'Arcserve' ) or title.find ( 'OLP NL' ) or title.find (
'LicSAPk' ) or title.find (
'Symantec' ) is not -1):
return 'null'
else:
return title
if (title != 'null'):
ws1 [ 'B1' ] = title
meta_desc = get_metaDesc ( u )
ws1 [ 'C1' ] = meta_desc
meta_keyWrds = get_metaKeyWrds ( u )
ws1 [ 'D1' ] = meta_keyWrds
print ( "writing product no." + str ( i ) )
else:
print("skipped product no. " + str ( i ))
continue;
问题是该程序排除了我的所有产品,而我看到的只是“跳过的产品编号”。? 为什么?不是所有人都有这些话……
慕桂英4014372
ibeautiful
相关分类