Python时间戳的24小时格式

Lan*_*nWO 12 python timestamp

Currentnly我正在使用Python时间模块创建时间戳.我使用此命令创建一个字符串

timestamp = time.strftime('%l:%M:%S')
Run Code Online (Sandbox Code Playgroud)

但是,这将以12小时格式打印格式.有没有办法我可以24小时格式这样做,所以它会显示为20:52:53而不是8:52:53?

谢谢!

mcd*_*mcd 15

尝试

timestamp = time.strftime('%H:%M:%S')
Run Code Online (Sandbox Code Playgroud)

有关Python时间模块的信息,请查看此链接

http://docs.python.org/2/library/time.html