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
chendajun
V2EX  ›  Python

Python 时间格式化问题,抓取网页时候会遇到各种各样的时间格式(需要格式化成: yyyy-mm-dd hh:mm:ss),现在遇到一种格式就需要往里面添加正则。是否有好的解决办法?!

  •  
  •   chendajun · 2016-10-20 16:55:17 +08:00 · 2711 次点击
    这是一个创建于 2738 天前的主题,其中的信息可能已经有所发展或是发生改变。
    7 条回复    2016-10-20 18:59:37 +08:00
    slysly759
        1
    slysly759  
       2016-10-20 18:01:14 +08:00 via Android
    你可以写一个通用时间轮子,然后坐等伸手党调用
    →_→
    yhxx
        2
    yhxx  
       2016-10-20 18:03:42 +08:00
    (用 js 来转, new Date().getTime 解决)
    pixstone
        3
    pixstone  
       2016-10-20 18:05:07 +08:00
    qiayue
        4
    qiayue  
       2016-10-20 18:06:08 +08:00
    PHP 大法好 strtotime() 支持各种时间格式
    zxbin1990
        5
    zxbin1990  
       2016-10-20 18:18:35 +08:00
    @qiayue 哈哈 :)
    guyskk
        6
    guyskk  
       2016-10-20 18:42:35 +08:00 via Android
    arrow
    freestyle
        7
    freestyle  
       2016-10-20 18:59:37 +08:00 via iPhone
    三楼 python-dateutil 轮子还支持多语言(包括中文)
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2945 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 03:37 · PVG 11:37 · LAX 20:37 · JFK 23:37
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.