Skip to content
New issue

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

第四章实战1:日期识别 建议修改 #43

Open
GZDXGeorge opened this issue Apr 15, 2022 · 1 comment
Open

第四章实战1:日期识别 建议修改 #43

GZDXGeorge opened this issue Apr 15, 2022 · 1 comment

Comments

@GZDXGeorge
Copy link

我使用的是python3.6版本

1、原代码结果

text1 = '我要住到明天下午三点'
print(text1, time_extract(text1), sep=':')

text2 = '预定28号的房间'
print(text2, time_extract(text2), sep=':')

text3 = '我要从26号下午4点住到11月2号'
print(text3, time_extract(text3), sep=':')

text4 = '我要预订今天到30的房间'
print(text4, time_extract(text4), sep=':')

text5 = '今天30号呵呵'
print(text5, time_extract(text5), sep=':')

image
修改:
word = (datetime.today() + timedelta(days=keyDate.get(k, 0))).strftime('%Y{0}%m{1}%d{2}').format('年','月','日')

2、日期问题

image
建议直接去掉 parse_datetime函数 的try except,直接用except的内容
image

@kangyuqi
Copy link

kangyuqi commented Apr 15, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants