我是网络新手,我试图用dpkt
解析pcap
,但是
ValueError: read of closed file.
代码如下:
import dpkt
f = open('test.pcapng', 'rb')
pcap = dpkt.pcap.Reader(f)
for timestamp, buf in pcap:
print (timestamp)
结果是:
1542964953.074129 Traceback (most recent call last): File "C:\Users\User\Documents\testdpkt1.py", line 19, in for ts, buf in pcap: File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\dpkt\pcap.py", line 312, in iter buf = self.f.read(PktHdr.__hdr_len) ValueError: read of closed file
你试过了吗?你知道吗
这样可以防止文件被关闭
相关问题 更多 >
编程相关推荐