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

如何获取网站页面的更新时间?

  •  
  •   omg21 · 2016-04-18 20:54:13 +08:00 · 2503 次点击
    这是一个创建于 2933 天前的主题,其中的信息可能已经有所发展或是发生改变。
    在浏览器中输入 javascript:alert(document.lastModified) 可以获取网站上 html 页面的更新时间,那么在 Python 中,应该如何做?
    SlipStupig
        1
    SlipStupig  
       2016-04-18 21:53:54 +08:00
    >>> k = lambda x: requests.head(x).headers['Date']
    >>> k('http://v2ex.com')
    'Mon, 18 Apr 2016 13:56:07 GMT'
    omg21
        2
    omg21  
    OP
       2016-04-18 22:20:14 +08:00
    @SlipStupig 这不是我要的结果,我表述有误,我想要的是页面的上传时间,或者说是页面的建立时间
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5269 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 08:26 · PVG 16:26 · LAX 01:26 · JFK 04:26
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.