我应该如何从 wxPython 的 FormatISOCombined(self, sep='T') 函数文档中读取 sep='T' ?
How should I read the sep='T' from the FormatISOCombined(self, sep='T') function documentation from wxPython?
假设我有这部分代码:
import wx
now = wx.DateTime.Now()
print (wx.DateTime.FormatISOCombined(now))
给出类似
的东西
2021-03-02T20:47:53
好的。现在,我不想使用 T 字符,而是想使用其他东西 – 让我们说 space,但不限于。 FormatISOCombined(self, sep='T') 的文档说:
The sep parameter default value produces the result exactly corresponding to the ISO standard, but it can also be useful to use a space as separator if a more human-readable combined date-time representation is needed.
Parameters
sep (int) –
但我不明白该如何阅读。
我试过 sep = ' '
,它给出了 ... argument 2 has unexpected type 'str'
,这似乎是正确的,正如参数描述明确指出的那样 (int);但是,这与函数定义中的 sep='T'
相比令人困惑。
我试过 sep = 0x20
结果是 ... argument 2 has unexpected type 'int'
,这就是为什么我什么都不懂了。
那么,我应该如何阅读文档?
这有点神秘,可能是错误或文档错误。
源代码只是在日期和时间
之间插入separator
wxString FormatISOCombined(char sep = 'T') const
{ return FormatISODate() + sep + FormatISOTime(); }
所以从实用的角度来说,您可能也应该这样做,至少您不会破坏任何东西。
print (wx.DateTime.FormatISODate(now)+" "+wx.DateTime.FormatISOTime(now))
2021-03-03 09:15:05
假设我有这部分代码:
import wx
now = wx.DateTime.Now()
print (wx.DateTime.FormatISOCombined(now))
给出类似
的东西2021-03-02T20:47:53
好的。现在,我不想使用 T 字符,而是想使用其他东西 – 让我们说 space,但不限于。 FormatISOCombined(self, sep='T') 的文档说:
The sep parameter default value produces the result exactly corresponding to the ISO standard, but it can also be useful to use a space as separator if a more human-readable combined date-time representation is needed.
Parameters
sep (int) –
但我不明白该如何阅读。
我试过 sep = ' '
,它给出了 ... argument 2 has unexpected type 'str'
,这似乎是正确的,正如参数描述明确指出的那样 (int);但是,这与函数定义中的 sep='T'
相比令人困惑。
我试过 sep = 0x20
结果是 ... argument 2 has unexpected type 'int'
,这就是为什么我什么都不懂了。
那么,我应该如何阅读文档?
这有点神秘,可能是错误或文档错误。
源代码只是在日期和时间
separator
wxString FormatISOCombined(char sep = 'T') const
{ return FormatISODate() + sep + FormatISOTime(); }
所以从实用的角度来说,您可能也应该这样做,至少您不会破坏任何东西。
print (wx.DateTime.FormatISODate(now)+" "+wx.DateTime.FormatISOTime(now))
2021-03-03 09:15:05