我正在这样使用strptime:
import time
time.strptime("+10:00","+%H:%M")
Run Code Online (Sandbox Code Playgroud)
但是“ +10:00”也可以是“ -10:00”(与UTC的时区偏移),这会破坏上述命令。我可以用
time.strptime("+10:00"[1:],"%H:%M")
Run Code Online (Sandbox Code Playgroud)
但理想情况下,我认为在格式代码前使用通配符更具可读性。
Python的strptime/ 是否存在这样的通配符运算符strftime?