0
我正在使用django框架&试图从pcap文件中获取Timestamp值。pcap文件(django)的时间戳值
我拆包位像:
unpacked = struct.unpack ('@ I H H i I I I I I I I' , raw_data[:40])
timestamp = time.strftime ('%Y-%m-%d %H:%M:%S' , time.localtime (unpacked))
,但得到错误 '时间戳'
Error: TypeError: an integer is required (got type tuple)
全部代码是在这里:https://github.com/manishkk/pcap-parser/blob/master/webapp/views.py
请帮我解决这个问题。
感谢
什么time.strftime() –
@ManishKumar:'的strftime()'需要一个元组,因此,如果'unpacked'是正确的格式,你可以直接使用它(不调用'本地时间()')。该格式在[这里]描述(https://docs.python.org/3/library/time.html#time.struct_time)。如果没有,你将不得不把它放在正确的格式。我对pcap一无所知,所以我无法帮到你。 –
如果我不使用它会给time.localtime错误 - 异常类型:\t TypeError 异常值:\t函数只需要9个参数(给定11个) –