time_tuple = dateTime.timetuple()typeError:unbound方法dateTime.timetuple()需要一个参数,这是我遇到的错误。如何解决?
import requests
import time
import pandas as pd
from datetime import datetime
def datetotimestamp(date):
time_tuple = datetime.timetuple()
timestamp = round(time.mktime(time_tuple))
return timestamp
start = datetotimestamp(datetime(2022,5,18))
end = datetotimestamp(datetime.today)
url = "https://priceapi.moneycontrol.com/techCharts/indianMarket/stock/history?symbol=RELIANCE&resolution=5&from='+str(start)+&to=+str(end)+"
print(url)
import requests
import time
import pandas as pd
from datetime import datetime
def datetotimestamp(date):
time_tuple = datetime.timetuple()
timestamp = round(time.mktime(time_tuple))
return timestamp
start = datetotimestamp(datetime(2022,5,18))
end = datetotimestamp(datetime.today)
url = "https://priceapi.moneycontrol.com/techCharts/indianMarket/stock/history?symbol=RELIANCE&resolution=5&from='+str(start)+&to=+str(end)+"
print(url)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
方法
timetuple()
是一个实例方法,您无法在datetime
类上调用,喜欢获取时间戳,只需使用
dateTime.timestamp()
The method
timetuple()
is an instance method, you can't call is ondatetime
class, do likeFor getting the timestamp just use
datetime.timestamp()