V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
songdg
V2EX  ›  Python

时间转化的问题

  •  
  •   songdg · 2019-09-21 20:35:28 +08:00 · 2264 次点击
    这是一个创建于 1650 天前的主题,其中的信息可能已经有所发展或是发生改变。
    如何将一个具体的 年月日时分秒(例如 2019 年 9 月 21 日 14:27:45 )转化为数值,像 time.time()获取到的数值。
    3 条回复    2019-09-22 08:04:41 +08:00
    zjqzxc
        1
    zjqzxc  
       2019-09-21 20:43:59 +08:00   ❤️ 1
    import time
    time.mktime(time.strptime("2019 年 9 月 21 日 14:27:45","%Y 年%m 月%d 日 %H:%M:%S"))
    zjqzxc
        2
    zjqzxc  
       2019-09-21 20:44:42 +08:00
    v 站自己给补了一堆空格,需要删除一下
    songdg
        3
    songdg  
    OP
       2019-09-22 08:04:41 +08:00
    @zjqzxc 谢谢帮助
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3135 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 13:00 · PVG 21:00 · LAX 06:00 · JFK 09:00
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.