datetime strptime(), 如何获取格式table
datetime strptime(), how to get format table
在 strftime() and strptime() behavior 的文档中列出了格式代码列表。日期时间如何存储它?我可以访问它吗?
我的意思是,当我使用 strptime(date_string, format) 时,它以某种方式处理 'format' 字符串,因此,它必须知道如何将“%d”关联到文档中描述的整数范围 '01, 02, …, 31'。那么,它如何存储这些关联,我可以访问它们吗?
The full set of format codes supported varies across platforms, because Python calls the platform C library’s strftime() function, and platform variations are common. To see the full set of format codes supported on your platform, consult the strftime(3) documentation.
在 Linux 和 macOS 上,您可以 运行 man strftime
查看支持的格式代码。
文档包含 table 个 standard format codes:
The following is a list of all the format codes that the C standard (1989 version) requires, and these work on all platforms with a standard C implementation. Note that the 1999 version of the C standard added additional format codes.
更新
针对您在下方的评论,格式代码是该平台的 C 库的一部分。我知道无法从 Python.
访问它们
在 strftime() and strptime() behavior 的文档中列出了格式代码列表。日期时间如何存储它?我可以访问它吗?
我的意思是,当我使用 strptime(date_string, format) 时,它以某种方式处理 'format' 字符串,因此,它必须知道如何将“%d”关联到文档中描述的整数范围 '01, 02, …, 31'。那么,它如何存储这些关联,我可以访问它们吗?
The full set of format codes supported varies across platforms, because Python calls the platform C library’s strftime() function, and platform variations are common. To see the full set of format codes supported on your platform, consult the strftime(3) documentation.
在 Linux 和 macOS 上,您可以 运行 man strftime
查看支持的格式代码。
文档包含 table 个 standard format codes:
The following is a list of all the format codes that the C standard (1989 version) requires, and these work on all platforms with a standard C implementation. Note that the 1999 version of the C standard added additional format codes.
更新
针对您在下方的评论,格式代码是该平台的 C 库的一部分。我知道无法从 Python.
访问它们