Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何将PyShark中的数据包解码为decode_as_Python_Python 3.x_Networking_Tshark_Pyshark - Fatal编程技术网

Python 如何将PyShark中的数据包解码为decode_as

Python 如何将PyShark中的数据包解码为decode_as,python,python-3.x,networking,tshark,pyshark,Python,Python 3.x,Networking,Tshark,Pyshark,在Wireshark GUI中,我们可以将UPD数据包解码为RTP,在tshark中也可以使用d==, 我怎样才能在PyShark做同样的事情? 我试着做了以下几件事 import pyshark cap = pyshark.FileCapture("Test.pcap", display filter='udp', decode_as='rtp') for pkt in cap: print(pkt) 但它显示了以下错误 AttributeError: 'str' object ha

在Wireshark GUI中,我们可以将UPD数据包解码为RTP,在tshark中也可以使用
d==,

我怎样才能在PyShark做同样的事情? 我试着做了以下几件事

import pyshark

cap = pyshark.FileCapture("Test.pcap", display filter='udp', decode_as='rtp')
for pkt in cap:
   print(pkt)
但它显示了以下错误

AttributeError: 'str' object has no attribute 'items'

解码_作为参数应该是dict而不是str 例如:

decode_as={'udp.port==1234':'rtp'}