We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
try: #uer "str" , because list not use topic = str(topic_split.findall(data)).replace('<h1 class=\"headline\">', '').replace('</h1>', '').replace('\\u3000', '', 20).replace('╱', '', 10).replace('[', '', 10).replace(']', '',10) author = str(author_split.findall(data)).replace('<span class=\"provider org\">', '').replace('</span>', '').replace('[', '', 10).replace(']', '',10) date = str(date_split.findall(data)).replace('>', '<', 10).split('<')[2] #this is so trouble, it is ["", "<abbr title = ...", "date", "</abbr>", ""], so is data[2] text = str(text_split.findall(data)).replace('<p class=\"first\">', '').replace('</p>', '', 100).replace(' ', '', 100).replace('<p>', '', 100).replace('[', '', 10).replace(']', '',10).replace('\',\'', '', 10) #deal with date if '下' in date: date = date.replace('下午', '') try: date = datetime.strptime(date, '%Y年%m月%d日 %H:%M') + timedelta(hours = 12) except: date = datetime.strptime(date, '%Y年%m月%d日 %H:%M') + timedelta(days = 1, hours = -12) else: date = date.replace('上午', '') date = datetime.strptime(date, '%Y年%m月%d日 %H:%M') self.data.append(News(topic, author, date, text).toJson()) print('第', len(self.data), '則新聞已擷取完') except: pass
為什麼 except 會直接 pass?
The text was updated successfully, but these errors were encountered:
linroex
No branches or pull requests
為什麼 except 會直接 pass?
The text was updated successfully, but these errors were encountered: