[英]TypeError: an integer is required (got type tuple) || website blocking code in python
I'm trying a website blocking program in python我正在尝试 python 中的网站阻止程序
TypeError: an integer is required (got type tuple) TypeError:需要一个 integer(获取类型元组)
I am getting this error when I try the below code.尝试以下代码时出现此错误。 Can someone please help me fix it?有人可以帮我解决吗?
from datetime import datetime as dt
if dt((dt.now().year, dt.now().month, dt.now().day, 19)) < dt.now() < dt(
(dt.now().year, dt.now().month, dt.now().day, 21)):
pass
You have extra parentheses in both date comparisons:在两个日期比较中都有额外的括号:
from datetime import datetime as dt
now = dt.now()
if dt(now.year, now.month, now.day, 19) < now < dt(now.year, now.month, now.day, 21):
pass
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.