请求 英文:[Python]Python网页编程 - 解析和生成 Last-Modified-Time
来源:百度文库 编辑:九乡新闻网 时间:2024/04/27 09:27:06
Python语言: Python网页编程 - 解析和生成 Last-Modified-Time#From: http://bugbox.blogspot.com/2005/05/python-with-last-modified-time.html
#
#Doing web programing sometime need to parse/create the
# Last-Modified-Time, Last-Modified-Since, or Date...
# values in the RFC2822 format. And I always forget the
# format string. Here we go:
>>> import time
>>> time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime())
'Fri, 20 May 2005 11:08:40 GMT'
>>> t = time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(time.time()))
>>> t
'Fri, 20 May 2005 11:22:20 GMT'
>>> time.strptime(t, "%a, %d %b %Y %H:%M:%S GMT")
(2005, 5, 20, 11, 22, 20, 4, 140, -1)
#So what these tell us? Well, the format string is:
"%a, %d %b %Y %H:%M:%S GMT"
#That's it. Yes, it is GMT time, no timezone there.
#
#Doing web programing sometime need to parse/create the
# Last-Modified-Time, Last-Modified-Since, or Date...
# values in the RFC2822 format. And I always forget the
# format string. Here we go:
>>> import time
>>> time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime())
'Fri, 20 May 2005 11:08:40 GMT'
>>> t = time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(time.time()))
>>> t
'Fri, 20 May 2005 11:22:20 GMT'
>>> time.strptime(t, "%a, %d %b %Y %H:%M:%S GMT")
(2005, 5, 20, 11, 22, 20, 4, 140, -1)
#So what these tell us? Well, the format string is:
"%a, %d %b %Y %H:%M:%S GMT"
#That's it. Yes, it is GMT time, no timezone there.
[Python]Python网页编程 - 解析和生成 Last-Modified-Time
[Python]python编程 FAQ
Python
python
Python 中的算法和编程方法(使用状态机)
编程中国?>>?Python成为2010年度语言
C++ 扩展和嵌入 Python
Python编程语言入门学习-编程语言-开发语言
Python input和raw_input的区别 [Python俱乐部]
[Python]python和C语言分别实现快速排序
[Python]python随笔
[Python]Python笔记-
[Python]一道笔试题,python的web编程,寻求高手帮忙
wxGlade - Python的可视化编程工具 - 开源中国社区
六本学习Python语言编程的免费电子书
python 数列
[Python]C#程序员初学Python
[Python]Python连接MySQL (例子)
[Python]python for ARM/LINUX
[Python]MySQLdb for Python使用指南
[Python]用Python操作Mysql
One Last Time
Python raw_input 读取输入值 [Python俱乐部]
[Python]年度黑马Python 自省指南