Python 最佳进口方式

Python 最佳进口方式,python,python-import,scapy,Python,Python Import,Scapy,我用过:从scapy.all import* 然而,在过去,我在名称空间中遇到了冲突(队列) 什么是最好的进口方式?我研究过的方法: import scapy import scapy.all from scapy import all 这可能是最好的方法 要一次导入所有层(针对它们测试数据包),请使用: 当我不想覆盖我的命名空间时,我经常使用: from scapy import all as scapy 之后,可在scapy下访问所有内容。: scapy.send(scapy.IP()

我用过:从scapy.all import* 然而,在过去,我在名称空间中遇到了冲突(队列)

什么是最好的进口方式?我研究过的方法:

import scapy
import scapy.all
from scapy import all
这可能是最好的方法

要一次导入所有层(针对它们测试数据包),请使用:

当我不想覆盖我的命名空间时,我经常使用:

from scapy import all as scapy
之后,可在
scapy下访问所有内容。

scapy.send(scapy.IP()/scapy.ICMP())

尝试使用from…import如果您像从scapy import all导入
,则您将覆盖内置函数。
from scapy import all as scapy
scapy.send(scapy.IP()/scapy.ICMP())
from scapy.all import srp,Ether,ARP,conf,send,arping