{"id":121332,"date":"2026-11-02T14:48:43","date_gmt":"2026-11-02T06:48:43","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/121332.html"},"modified":"2026-11-02T14:48:43","modified_gmt":"2026-11-02T06:48:43","slug":"%e5%86%99%e5%87%ba%e5%8e%bb%e7%9a%84%e6%97%b6%e9%97%b4%ef%bc%8c%e8%87%aa%e5%b7%b1%e8%af%bb%e4%b8%8d%e5%9b%9e%e6%9d%a5","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/121332.html","title":{"rendered":"\u5199\u51fa\u53bb\u7684\u65f6\u95f4\uff0c\u81ea\u5df1\u8bfb\u4e0d\u56de\u6765"},"content":{"rendered":"<p>tomlkit \u7684\u5356\u70b9\u662f round-trip&#xff1a;\u8bfb\u8fdb\u6765\u7684\u6587\u6863&#xff0c;\u5199\u51fa\u53bb\u8fd8\u4fdd\u6301\u539f\u6837\u3002\u4e0b\u9762\u8fd9\u6bb5\u7684\u6700\u540e\u4e00\u884c\u629b\u5f02\u5e38\u3002<\/p>\n<p><span class=\"token keyword\">from<\/span> datetime <span class=\"token keyword\">import<\/span> time<span class=\"token punctuation\">,<\/span> timedelta<span class=\"token punctuation\">,<\/span> timezone<br \/>\n<span class=\"token keyword\">from<\/span> tomlkit <span class=\"token keyword\">import<\/span> dumps<span class=\"token punctuation\">,<\/span> item<span class=\"token punctuation\">,<\/span> parse<\/p>\n<p>t <span class=\"token operator\">&#061;<\/span> time<span class=\"token punctuation\">(<\/span><span class=\"token number\">7<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">32<\/span><span class=\"token punctuation\">,<\/span> tzinfo<span class=\"token operator\">&#061;<\/span>timezone<span class=\"token punctuation\">(<\/span>timedelta<span class=\"token punctuation\">(<\/span>hours<span class=\"token operator\">&#061;<\/span><span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><br \/>\nparse<span class=\"token punctuation\">(<\/span>dumps<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">{<\/span><span class=\"token string\">&#034;t&#034;<\/span><span class=\"token punctuation\">:<\/span> item<span class=\"token punctuation\">(<\/span>t<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token comment\"># InvalidTimeError: Invalid time at line 1 col 18<\/span><\/p>\n<p>\u5b83\u5199\u51fa\u7684\u90a3\u4e00\u884c\u662f t &#061; 07:32:00&#043;02:00&#xff0c;\u81ea\u5df1\u7684\u89e3\u6790\u5668\u4e0d\u8ba4\u3002<\/p>\n<h3>\u516d\u4e2a\u5b57\u7b26&#xff0c;\u6ca1\u6709\u4f4d\u7f6e<\/h3>\n<p>TOML 1.0 \u5bf9 Local Time \u7684\u5b9a\u4e49\u662f&#xff1a;<\/p>\n<p>If you include only the time portion of an RFC 3339 formatted date-time, it will represent that time of day without any relation to a specific day or any offset or timezone.<\/p>\n<p>\u89c4\u8303\u7ed9\u7684\u4f8b\u5b50\u662f lt1 &#061; 07:32:00\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261102064842-6ae8324a96f35.png\" alt=\"\u540c\u4e00\u4e2a time \u5bf9\u8c61\uff0c\u4e94\u4e2a\u5b57\u6bb5\uff1bTOML \u7684 Local Time \u53ea\u6709\u524d\u9762\u56db\u4e2a\u7684\u4f4d\u7f6e\" \/><\/p>\n<p>07:32:00 \u662f Local Time\u3002&#043;02:00 \u8fd9\u516d\u4e2a\u5b57\u7b26&#xff0c;\u5728 TOML \u7684 Local Time \u8bed\u6cd5\u91cc\u6ca1\u6709\u5bf9\u5e94\u7684\u4f4d\u7f6e\u3002<\/p>\n<p>\u504f\u79fb TOML \u4e5f\u80fd\u5199&#xff0c;\u4f46\u90a3\u53eb Offset Date-Time&#xff0c;\u5fc5\u987b\u540c\u65f6\u5e26\u65e5\u671f&#xff1a;1979-05-27T07:32:00&#043;02:00\u3002\u5355\u72ec\u7684 time \u6ca1\u6709\u5730\u65b9\u6302\u5b83\u3002<\/p>\n<h3>raw \u4e0d\u662f isoformat \u7684\u526f\u672c<\/h3>\n<p>Time \u8fd9\u4e2a item \u540c\u65f6\u5b58\u4e24\u6837\u4e1c\u897f&#xff1a;Python \u7684 tzinfo&#xff0c;\u548c\u8981\u5199\u8fdb TOML \u7684 raw \u5b57\u9762\u91cf\u3002<\/p>\n<p>tzinfo \u7559\u5728 Python \u5bf9\u8c61\u4e0a\u6ca1\u6709\u95ee\u9898\u2014\u2014datetime.time \u672c\u6765\u5c31\u53ef\u4ee5\u5e26\u65f6\u533a\u3002\u95ee\u9898\u51fa\u5728 raw \u88ab\u5f53\u6210\u4e86 isoformat() \u7684\u526f\u672c\u3002\u4fee\u524d\u7248\u91cc&#xff0c;item() \u6784\u9020 Time \u65f6\u8fd9\u6837\u5199&#xff1a;<\/p>\n<p>Time<span class=\"token punctuation\">(<\/span><br \/>\n    value<span class=\"token punctuation\">.<\/span>hour<span class=\"token punctuation\">,<\/span><br \/>\n    value<span class=\"token punctuation\">.<\/span>minute<span class=\"token punctuation\">,<\/span><br \/>\n    value<span class=\"token punctuation\">.<\/span>second<span class=\"token punctuation\">,<\/span><br \/>\n    value<span class=\"token punctuation\">.<\/span>microsecond<span class=\"token punctuation\">,<\/span><br \/>\n    value<span class=\"token punctuation\">.<\/span>tzinfo<span class=\"token punctuation\">,<\/span><br \/>\n    Trivia<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    value<span class=\"token punctuation\">.<\/span>isoformat<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span>      <span class=\"token comment\"># -&gt; &#039;07:32:00&#043;02:00&#039;<\/span><br \/>\n    fold<span class=\"token operator\">&#061;<\/span>value<span class=\"token punctuation\">.<\/span>fold<span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><\/p>\n<p>\u5728 item() \u91cc&#xff0c;datetime \u90a3\u4e00\u652f\u5c31\u5728\u8fd9\u6bb5\u4e0a\u9762\u51e0\u884c&#xff0c;raw \u662f value.isoformat().replace(&#034;&#043;00:00&#034;, &#034;Z&#034;)&#xff1b;time \u8fd9\u4e00\u652f\u76f4\u63a5\u662f value.isoformat()\u3002<\/p>\n<p>isoformat() \u662f Python \u7684\u683c\u5f0f&#xff0c;\u4f1a\u628a tzinfo \u6e32\u67d3\u6210\u504f\u79fb&#xff0c;\u800c TOML \u7684 Local Time \u6ca1\u6709\u8fd9\u4e00\u6bb5\u3002<\/p>\n<p>\u53e6\u4e00\u5904\u662f Time._new()&#xff0c;replace() \u8d70\u90a3\u91cc&#xff0c;raw \u540c\u6837\u662f result.isoformat()\u3002<\/p>\n<h3>\u53ea\u6539\u5199\u51fa\u7aef<\/h3>\n<p>#613 \u589e\u52a0\u4e86\u4e00\u4e2a _format_time()&#xff1a;<\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">_format_time<\/span><span class=\"token punctuation\">(<\/span>value<span class=\"token punctuation\">:<\/span> time<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token comment\"># TOML local times carry no offset or timezone &#8230;<\/span><br \/>\n    s <span class=\"token operator\">&#061;<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>value<span class=\"token punctuation\">.<\/span>hour<span class=\"token punctuation\">:<\/span><span class=\"token format-spec\">02d<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">:<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>value<span class=\"token punctuation\">.<\/span>minute<span class=\"token punctuation\">:<\/span><span class=\"token format-spec\">02d<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">:<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>value<span class=\"token punctuation\">.<\/span>second<span class=\"token punctuation\">:<\/span><span class=\"token format-spec\">02d<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><br \/>\n    <span class=\"token keyword\">if<\/span> value<span class=\"token punctuation\">.<\/span>microsecond<span class=\"token punctuation\">:<\/span><br \/>\n        s <span class=\"token operator\">&#043;&#061;<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;.<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>value<span class=\"token punctuation\">.<\/span>microsecond<span class=\"token punctuation\">:<\/span><span class=\"token format-spec\">06d<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">.<\/span>rstrip<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;0&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> s<\/p>\n<p>item() \u548c Time._new() \u90fd\u6539\u7528\u5b83\u3002<\/p>\n<p>\u5408\u5e76\u7248\u89c1 ce8f8ee \u7684 items.py \u4e0e _format_time()\u3002<\/p>\n<p>\u53ea\u7528\u65f6\u3001\u5206\u3001\u79d2\u3001\u5fae\u79d2&#xff0c;\u4e0d\u8bfb tzinfo\u3002\u5fae\u79d2\u975e\u96f6\u65f6\u8865\u8db3\u516d\u4f4d\u518d\u53bb\u5c3e\u96f6&#xff1a;123450 \u5199\u6210 .12345&#xff0c;0 \u4e0d\u5199\u5c0f\u6570\u70b9\u3002<\/p>\n<p>\u89e3\u6790\u5668\u6ca1\u6709\u6539\u3002parse(&#034;t &#061; 07:32:00&#043;02:00&#034;) \u4fee\u524d\u4fee\u540e\u90fd\u629b InvalidTimeError\u2014\u2014TOML \u91cc\u6ca1\u6709\u8fd9\u4e2a\u8bed\u6cd5\u3002<\/p>\n<h3>\u51b2\u7a81\u6765\u81ea\u9694\u58c1<\/h3>\n<p>#613 \u5408\u5e76\u524d&#xff0c;\u7ef4\u62a4\u8005\u7559\u4e86\u4e00\u53e5 \u201cPlease resolve the conflict\u201d\u3002<\/p>\n<p>\u51b2\u7a81\u6765\u81ea #620&#xff1a;\u5b83\u7ed9 Time \u548c DateTime \u52a0\u4e86\u6807\u51c6\u5e93\u7684 fold \u53c2\u6570&#xff0c;\u6539\u7684\u6b63\u662f Time._new() \u9644\u8fd1\u3002\u4e24\u4e2a PR \u5728\u540c\u4e00\u5929\u5408\u5165&#xff0c;#620 \u65e9\u4e86\u4e09\u4e2a\u534a\u5c0f\u65f6\u3002\u4f5c\u8005 rebase \u5230\u6700\u65b0 master \u540e&#xff0c;fold&#061;result.fold \u548c _format_time(result) \u5171\u5b58\u5728\u540c\u4e00\u4e2a\u6784\u9020\u51fd\u6570\u91cc&#xff1a;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/i-blog.csdnimg.cn\/direct\/8d881295ada048688e27154f969f4a4a.png#pic_center\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">_new<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> result<span class=\"token punctuation\">:<\/span> time<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span><span class=\"token operator\">&gt;<\/span> Time<span class=\"token punctuation\">:<\/span><br \/>\n    raw <span class=\"token operator\">&#061;<\/span> _format_time<span class=\"token punctuation\">(<\/span>result<span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> Time<span class=\"token punctuation\">(<\/span><br \/>\n        <span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">,<\/span><br \/>\n        raw<span class=\"token punctuation\">,<\/span><br \/>\n        fold<span class=\"token operator\">&#061;<\/span>result<span class=\"token punctuation\">.<\/span>fold<span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token punctuation\">)<\/span><\/p>\n<p>fold \u63cf\u8ff0\u7684\u662f\u590f\u4ee4\u65f6\u56de\u62e8\u65f6\u540c\u4e00\u4e2a\u672c\u5730\u65f6\u95f4\u51fa\u73b0\u4e24\u6b21&#xff0c;\u5c5e\u4e8e Python time \u5bf9\u8c61\u81ea\u8eab\u7684\u8bed\u4e49&#xff1b;_format_time() \u51b3\u5b9a\u7684\u662f\u8fd9\u4e2a\u5bf9\u8c61\u600e\u4e48\u5199\u8fdb TOML\u3002\u4e24\u4ef6\u4e8b\u843d\u5728\u540c\u4e00\u4e2a\u6784\u9020\u51fd\u6570\u91cc&#xff0c;\u4e92\u4e0d\u76f8\u5e72\u3002<\/p>\n<h3>\u4e03\u884c\u8f93\u51fa<\/h3>\n<table>\n<tr>\u7528\u4f8b\u4fee\u524d 763bd66\u5408\u5e76\u7248 ce8f8ee<\/tr>\n<tbody>\n<tr>\n<td>item(time(7, 32, tzinfo&#061;&#043;02:00)).as_string()<\/td>\n<td>07:32:00&#043;02:00<\/td>\n<td>07:32:00<\/td>\n<\/tr>\n<tr>\n<td>\u5fae\u79d2 123450<\/td>\n<td>07:32:00.123450&#043;02:00<\/td>\n<td>07:32:00.12345<\/td>\n<\/tr>\n<tr>\n<td>replace(hour&#061;13)<\/td>\n<td>13:32:00&#043;02:00<\/td>\n<td>13:32:00<\/td>\n<\/tr>\n<tr>\n<td>dumps({&#034;t&#034;: item(&#8230;)})<\/td>\n<td>t &#061; 07:32:00&#043;02:00<\/td>\n<td>t &#061; 07:32:00<\/td>\n<\/tr>\n<tr>\n<td>\u628a\u4e0a\u4e00\u6b65 parse() \u56de\u6765<\/td>\n<td>InvalidTimeError<\/td>\n<td>\u6210\u529f&#xff0c;\u8bfb\u56de 07:32:00<\/td>\n<\/tr>\n<tr>\n<td>\u65e0\u65f6\u533a\u7684 time(7, 32)<\/td>\n<td>07:32:00<\/td>\n<td>07:32:00<\/td>\n<\/tr>\n<tr>\n<td>\u76f4\u63a5 parse(&#034;t &#061; 07:32:00&#043;02:00&#034;)<\/td>\n<td>InvalidTimeError<\/td>\n<td>InvalidTimeError<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6700\u540e\u4e24\u884c\u8bf4\u660e\u6539\u7684\u53ea\u662f\u5199\u51fa\u7aef&#xff1a;\u65e0\u65f6\u533a\u7684\u65f6\u95f4&#xff0c;\u8f93\u51fa\u4e00\u4e2a\u5b57\u8282\u6ca1\u53d8&#xff1b;\u89e3\u6790\u5668\u5bf9\u504f\u79fb\u7684\u62d2\u7edd\u7167\u65e7\u3002<\/p>\n<p>0.15.2 \u7684\u53d1\u5e03\u8bf4\u660e\u660e\u786e\u5217\u51fa\u4e86 #613\u3002\u7528\u53d1\u5e03\u8f6e\u5b50 tomlkit-0.15.2-py3-none-any.whl \u518d\u8dd1\u4e00\u6b21&#xff0c;\u8f93\u51fa\u548c\u5408\u5e76\u7248\u4e00\u81f4&#xff1a;07:32:00&#xff0c;\u8bfb\u5f97\u56de\u6765\u3002<\/p>\n<h3>\u8bfb\u56de\u6765\u7684\u662f\u4ec0\u4e48<\/h3>\n<p>parse<span class=\"token punctuation\">(<\/span>dumps<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">{<\/span><span class=\"token string\">&#034;t&#034;<\/span><span class=\"token punctuation\">:<\/span> item<span class=\"token punctuation\">(<\/span>t<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">[<\/span><span class=\"token string\">&#034;t&#034;<\/span><span class=\"token punctuation\">]<\/span>     <span class=\"token comment\"># 07:32:00<\/span><\/p>\n<p>\u80fd\u8bfb\u56de\u6765\u4e86\u3002\u8bfb\u56de\u6765\u7684 Time \u662f 07:32:00&#xff0c;tzinfo \u662f None\u2014\u2014\u90a3\u4e00\u884c\u6587\u672c\u91cc\u6ca1\u6709\u8fd9\u6bb5\u4fe1\u606f\u3002<\/p>\n<p>local_time_demo\/run.py &#8211;test \u8dd1\u4e0a\u8868\u4e03\u884c\u3002<\/p>\n<p>Time \u91cc&#xff0c;Python \u7684 time \u80fd\u5e26\u65f6\u533a\u3001\u80fd\u5e26 fold&#xff1b;\u5199\u8fdb TOML \u7684\u90a3\u4e00\u6bb5\u53ea\u6709\u65f6\u5206\u79d2\u548c\u53ef\u9009\u7684\u5fae\u79d2\u3002\u591a\u51fa\u6765\u7684\u7559\u5728\u5bf9\u8c61\u4e0a&#xff0c;\u4e0d\u8fdb\u6587\u4ef6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>tomlkit \u7684\u5356\u70b9\u662f round-trip&#xff1a;\u8bfb\u8fdb\u6765\u7684\u6587\u6863&#xff0c;\u5199\u51fa\u53bb\u8fd8\u4fdd\u6301\u539f\u6837\u3002\u4e0b\u9762\u8fd9\u6bb5\u7684\u6700\u540e\u4e00\u884c\u629b\u5f02\u5e38\u3002<br \/>\nfrom datetime import time, timedelta, timezone<br \/>\nfrom tomlkit import dumps, item, parset  time(7, 32, tzinfotimezone(timedelta(hours2)))<br \/>\nparse(dumps({\\&#8221;t\\&#8221;: item(t)}))<br \/>\n# Inval<\/p>\n","protected":false},"author":2,"featured_media":121331,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[81],"topic":[],"class_list":["post-121332","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5199\u51fa\u53bb\u7684\u65f6\u95f4\uff0c\u81ea\u5df1\u8bfb\u4e0d\u56de\u6765 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/121332.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5199\u51fa\u53bb\u7684\u65f6\u95f4\uff0c\u81ea\u5df1\u8bfb\u4e0d\u56de\u6765 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"tomlkit \u7684\u5356\u70b9\u662f round-trip&#xff1a;\u8bfb\u8fdb\u6765\u7684\u6587\u6863&#xff0c;\u5199\u51fa\u53bb\u8fd8\u4fdd\u6301\u539f\u6837\u3002\u4e0b\u9762\u8fd9\u6bb5\u7684\u6700\u540e\u4e00\u884c\u629b\u5f02\u5e38\u3002 from datetime import time, timedelta, timezone from tomlkit import dumps, item, parset time(7, 32, tzinfotimezone(timedelta(hours2))) parse(dumps({&quot;t&quot;: item(t)})) # Inval\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/121332.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-02T06:48:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261102064842-6ae8324a96f35.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/121332.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/121332.html\",\"name\":\"\u5199\u51fa\u53bb\u7684\u65f6\u95f4\uff0c\u81ea\u5df1\u8bfb\u4e0d\u56de\u6765 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-11-02T06:48:43+00:00\",\"dateModified\":\"2026-11-02T06:48:43+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/121332.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/121332.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/121332.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5199\u51fa\u53bb\u7684\u65f6\u95f4\uff0c\u81ea\u5df1\u8bfb\u4e0d\u56de\u6765\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5199\u51fa\u53bb\u7684\u65f6\u95f4\uff0c\u81ea\u5df1\u8bfb\u4e0d\u56de\u6765 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/121332.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5199\u51fa\u53bb\u7684\u65f6\u95f4\uff0c\u81ea\u5df1\u8bfb\u4e0d\u56de\u6765 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"tomlkit \u7684\u5356\u70b9\u662f round-trip&#xff1a;\u8bfb\u8fdb\u6765\u7684\u6587\u6863&#xff0c;\u5199\u51fa\u53bb\u8fd8\u4fdd\u6301\u539f\u6837\u3002\u4e0b\u9762\u8fd9\u6bb5\u7684\u6700\u540e\u4e00\u884c\u629b\u5f02\u5e38\u3002 from datetime import time, timedelta, timezone from tomlkit import dumps, item, parset time(7, 32, tzinfotimezone(timedelta(hours2))) parse(dumps({\"t\": item(t)})) # Inval","og_url":"https:\/\/www.wsisp.com\/helps\/121332.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-11-02T06:48:43+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261102064842-6ae8324a96f35.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/121332.html","url":"https:\/\/www.wsisp.com\/helps\/121332.html","name":"\u5199\u51fa\u53bb\u7684\u65f6\u95f4\uff0c\u81ea\u5df1\u8bfb\u4e0d\u56de\u6765 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-11-02T06:48:43+00:00","dateModified":"2026-11-02T06:48:43+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/121332.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/121332.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/121332.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5199\u51fa\u53bb\u7684\u65f6\u95f4\uff0c\u81ea\u5df1\u8bfb\u4e0d\u56de\u6765"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/121332","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=121332"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/121332\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/121331"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=121332"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=121332"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=121332"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=121332"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}