I'm reading a pcap file using the rdpcap
function:
s = rdpcap(pcap)
I'd like to know how to reverse s
: it should be a list, but I tried with:
rev_s = s.reverse()
and it doesn't work: it gives me the SyntaxError: invalid syntax
error.
Can anyone help me, please?
For me, this works:
>>> a = rdpcap("test.pcap")
>>> b = a.reverse()
>>> c = a[::-1]
(you can also use the slice notation to create a reversed copy of the list)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.