小编use*_*110的帖子

将时间转换为纪元(Python)

我用tweepy来发推文.我试图通过Slack发送这条推文.Tweepy以奇怪的格式给出时间,Slack需要时间在epoch中.

for i in tweets:
    created=(i.created_at)
    print(created)
    print(created.strftime('%s'))
Run Code Online (Sandbox Code Playgroud)

这回来了

2017-01-17 14:36:26

Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\slackbot3\run.py", line 287, in main
print(created.strftime('%s'))
ValueError: Invalid format string
Run Code Online (Sandbox Code Playgroud)

怎么能把2017-01-17 14:36:26送到纪元时间?

python datetime epoch tweepy python-2.7

5
推荐指数
1
解决办法
6961
查看次数

标签 统计

datetime ×1

epoch ×1

python ×1

python-2.7 ×1

tweepy ×1