Parse A *.nfo File With Python
I try to parse a nfo file and print in a html code style (a table). I tried with xml.etree but i get only 2 elements: Metadata and Category. This is how a .nfo looks like:
Solution 1:
I'm guessing you might be looking to parse through the .nfo output from MSINFO32. The below code was what I found to be the most straightforward way to parse through the entire file, and come out with usable objects.
for element in root.iter('Data'):
out = []
for n inrange(len(element)):
out.append('{0}'.format(element[n].text))
print(out)
The output looks like:
['OS Name', 'Microsoft Windows 10 Enterprise Evaluation']['Version', '10.0.15063 Build 15063']['Other OS Description ', 'Not Available']['OS Manufacturer', 'Microsoft Corporation']['System Name', 'WIN10BLANK']['System Manufacturer', 'Microsoft Corporation']['System Model', 'Virtual Machine']['System Type', 'x64-based PC']['System SKU', 'Unsupported']
Post a Comment for "Parse A *.nfo File With Python"