我有一个如图所示的文件。我想检索文件 ID、作者和描述。在某些 fileid 中,没有文件的描述。但是在一些fileid(即fileid=3)中,有一个文件的描述。我想知道如何在 Python 中获得描述。谢谢你。
start=re.compile('<file fileid=(\d+)\s*>')
end=re.compile('</file\s*>')
The Document starts from here:
--------------------------------------
<file fileid=11>
System File 765411
J.K
STAV December, 1959
</file>
<file fileid=12>
Batch File
James P.
STAV December, 1959
</file>
<file fileid=13>
Empty file
Person:Wolfe, P.
STAV December, 1959
This is a description of the empty file.
You need to put this file in the D:\location\systemB.
After putting the file to the location, the system will boot up.
Later, System B will refresh itself and show the output.
</file>
<file fileid=14>
Nomal File
Mercy Lusia
STAV December, 1959
</file>