不能在Python中输入(file.xml)



我想通过cmd输入文件名。所以我使用

file1=input("File Scan1: ")

但是当我输入File1.xml这样的文件名链接时,Python告诉我:

Traceback (most recent call last):
File "compare.py", line 6, in <module>
file1=input("File Scan1: ")
File "<string>", line 1, in <module>
AttributeError: type object 'file' has no attribute 'xml'```
How can i solve this?

这是我的代码。它正在比较两个nmap扫描并确定哪个mac地址实际上没有被使用

from xml.dom import minidom

print("Compare 2 Nmap Mac Scans /n")
file1=input("File Scan1: ")
file2=input("File Scan2: ")
xmldoc1=minidom.parse(file1)
hosts=xmldoc1.getElementsByTagName('host')
xmldoc2=minidom.parse(file2)
maclist1=[]
maclist2=[]
for host in hosts:
adress=host.getElementsByTagName("address")

if len(adress) > 1:  

mac=adress[1].attributes["addr"]
MAC=mac.value
maclist1.append(MAC)

hosts=xmldoc2.getElementsByTagName('host')

for host in hosts:
adress=host.getElementsByTagName("address")

if len(adress) > 1:  

mac=adress[1].attributes["addr"]
MAC=mac.value
maclist2.append(MAC)

for i in maclist1:
for j in maclist2:
if(i!=j):
print(i)