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個) –