简体   繁体   English

类型错误:需要一个 integer(获取类型元组)|| python 中的网站阻止代码

[英]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.

相关问题 TypeError:需要一个 integer(获取类型元组)<python><opencv><tesseract></tesseract></opencv></python> - TypeError: an integer is required (got type tuple) <python> <OpenCV> <tesseract> Python TypeError:需要一个整数(得到类型元组)-(OpenCV / Numpy) - Python TypeError: an integer is required (got type tuple) - (OpenCV / Numpy) 类型错误:需要一个 integer(获取类型元组)日期时间 Python - TypeError: an integer is required (got type tuple) datetime Python Python TypeError:整数是必需的(got类型列表) - Python TypeError: an integer is required (got type list) Python:类型错误:需要一个整数(得到类型 str) - Python: TypeError: an integer is required (got type str) TypeError:Python中需要一个整数(类型为str) - TypeError: an integer is required (got type str) in python Python: TypeError: an integer is required (got type module) - Python: TypeError: an integer is required (got type module) Python:TypeError 需要 integer(获取类型 str) - Python: TypeError an integer is required(got type str) 枕头图像TypeError:需要一个整数(元组类型元组) - pillow image TypeError: an integer is required (got type tuple) pybullet 代码中的类型错误:需要 integer(获取类型列表) - TypeError in pybullet code: an integer is required (got type list)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM