久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <small id='XxqUY'></small><noframes id='XxqUY'>

  1. <i id='XxqUY'><tr id='XxqUY'><dt id='XxqUY'><q id='XxqUY'><span id='XxqUY'><b id='XxqUY'><form id='XxqUY'><ins id='XxqUY'></ins><ul id='XxqUY'></ul><sub id='XxqUY'></sub></form><legend id='XxqUY'></legend><bdo id='XxqUY'><pre id='XxqUY'><center id='XxqUY'></center></pre></bdo></b><th id='XxqUY'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='XxqUY'><tfoot id='XxqUY'></tfoot><dl id='XxqUY'><fieldset id='XxqUY'></fieldset></dl></div>

    <tfoot id='XxqUY'></tfoot>
      <bdo id='XxqUY'></bdo><ul id='XxqUY'></ul>
      <legend id='XxqUY'><style id='XxqUY'><dir id='XxqUY'><q id='XxqUY'></q></dir></style></legend>

    1. Python UTC 日期時(shí)間對(duì)象的 ISO 格式不包括 Z(祖魯語(yǔ)

      Python UTC datetime object#39;s ISO format doesn#39;t include Z (Zulu or Zero offset)(Python UTC 日期時(shí)間對(duì)象的 ISO 格式不包括 Z(祖魯語(yǔ)或零偏移))

    2. <tfoot id='2A25l'></tfoot>
        <tbody id='2A25l'></tbody>
      • <bdo id='2A25l'></bdo><ul id='2A25l'></ul>
      • <legend id='2A25l'><style id='2A25l'><dir id='2A25l'><q id='2A25l'></q></dir></style></legend>
      • <small id='2A25l'></small><noframes id='2A25l'>

        <i id='2A25l'><tr id='2A25l'><dt id='2A25l'><q id='2A25l'><span id='2A25l'><b id='2A25l'><form id='2A25l'><ins id='2A25l'></ins><ul id='2A25l'></ul><sub id='2A25l'></sub></form><legend id='2A25l'></legend><bdo id='2A25l'><pre id='2A25l'><center id='2A25l'></center></pre></bdo></b><th id='2A25l'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='2A25l'><tfoot id='2A25l'></tfoot><dl id='2A25l'><fieldset id='2A25l'></fieldset></dl></div>

                本文介紹了Python UTC 日期時(shí)間對(duì)象的 ISO 格式不包括 Z(祖魯語(yǔ)或零偏移)的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                問(wèn)題描述

                為什么 python 2.7 不像 JavaScript 那樣在 UTC 日期時(shí)間對(duì)象的 isoformat 字符串的末尾不包含 Z 字符(Zulu 或零偏移)?

                Why python 2.7 doesn't include Z character (Zulu or zero offset) at the end of UTC datetime object's isoformat string unlike JavaScript?

                >>> datetime.datetime.utcnow().isoformat()
                '2013-10-29T09:14:03.895210'
                

                而在 javascript 中

                Whereas in javascript

                >>>  console.log(new Date().toISOString()); 
                2013-10-29T09:38:41.341Z
                

                推薦答案

                Python datetime 對(duì)象默認(rèn)沒(méi)有時(shí)區(qū)信息,沒(méi)有它,Python 實(shí)際上違反了 ISO 8601 規(guī)范(如果沒(méi)有給出時(shí)區(qū)信息,則假定為當(dāng)?shù)貢r(shí)間).您可以使用 pytz 包 來(lái)獲取一些默認(rèn)時(shí)區(qū),或者直接子類(lèi)化 tzinfo 你自己:

                Python datetime objects don't have time zone info by default, and without it, Python actually violates the ISO 8601 specification (if no time zone info is given, assumed to be local time). You can use the pytz package to get some default time zones, or directly subclass tzinfo yourself:

                from datetime import datetime, tzinfo, timedelta
                class simple_utc(tzinfo):
                    def tzname(self,**kwargs):
                        return "UTC"
                    def utcoffset(self, dt):
                        return timedelta(0)
                

                然后你可以手動(dòng)將時(shí)區(qū)信息添加到utcnow():

                Then you can manually add the time zone info to utcnow():

                >>> datetime.utcnow().replace(tzinfo=simple_utc()).isoformat()
                '2014-05-16T22:51:53.015001+00:00'
                

                請(qǐng)注意,這符合 ISO 8601 格式,該格式允許 Z+00:00 作為 UTC 的后綴.請(qǐng)注意,后者實(shí)際上更符合標(biāo)準(zhǔn),通常表示時(shí)區(qū)(UTC 是一個(gè)特例.)

                Note that this DOES conform to the ISO 8601 format, which allows for either Z or +00:00 as the suffix for UTC. Note that the latter actually conforms to the standard better, with how time zones are represented in general (UTC is a special case.)

                這篇關(guān)于Python UTC 日期時(shí)間對(duì)象的 ISO 格式不包括 Z(祖魯語(yǔ)或零偏移)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                相關(guān)文檔推薦

                python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個(gè)模塊和類(lèi))
                Configuring Python to use additional locations for site-packages(配置 Python 以使用站點(diǎn)包的其他位置)
                How to structure python packages without repeating top level name for import(如何在不重復(fù)導(dǎo)入頂級(jí)名稱(chēng)的情況下構(gòu)造python包)
                Install python packages on OpenShift(在 OpenShift 上安裝 python 包)
                How to refresh sys.path?(如何刷新 sys.path?)
                Distribute a Python package with a compiled dynamic shared library(分發(fā)帶有已編譯動(dòng)態(tài)共享庫(kù)的 Python 包)

                    <i id='F3OpX'><tr id='F3OpX'><dt id='F3OpX'><q id='F3OpX'><span id='F3OpX'><b id='F3OpX'><form id='F3OpX'><ins id='F3OpX'></ins><ul id='F3OpX'></ul><sub id='F3OpX'></sub></form><legend id='F3OpX'></legend><bdo id='F3OpX'><pre id='F3OpX'><center id='F3OpX'></center></pre></bdo></b><th id='F3OpX'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='F3OpX'><tfoot id='F3OpX'></tfoot><dl id='F3OpX'><fieldset id='F3OpX'></fieldset></dl></div>
                    1. <tfoot id='F3OpX'></tfoot>
                        <tbody id='F3OpX'></tbody>

                      • <small id='F3OpX'></small><noframes id='F3OpX'>

                        <legend id='F3OpX'><style id='F3OpX'><dir id='F3OpX'><q id='F3OpX'></q></dir></style></legend>
                          <bdo id='F3OpX'></bdo><ul id='F3OpX'></ul>
                          主站蜘蛛池模板: 一区二区三区不卡视频 | 国产视频一区二区在线播放 | 久久精品久久久久 | 婷婷99| 日日干夜夜爽 | 91女人18毛片水多国产 | 羞羞网站在线观看 | 日韩三级一区二区 | 日韩1级片 | 国产精品久久久久久久久久久久久 | 欧美大片18 | 在线观看中文字幕 | 日日夜夜天天 | 天天操天天操 | 亚洲高清在线 | 99视频免费观看 | 国产精品久久久国产盗摄 | 欧美精品日韩少妇 | 欧美日韩国产在线 | 亚洲精品网站在线观看 | 亚洲成人免费 | 激情av网站 | 免费高清av | 激情六月婷婷 | 波多野结衣乳巨码无在线观看 | 国产伦精品一区二区三区88av | 国产精品第五页 | 日本不卡视频在线观看 | 色香蕉网 | 亚洲视频网 | 久久久久国产视频 | 国产乱码久久久久久 | 亚洲久热 | 三级黄色在线观看 | 香蕉视频导航 | 国产精品呻吟 | 婷婷午夜天| 日韩欧美精品一区二区 | 白白色免费视频 | av黄色片 | 国产精品不卡视频 |