I've been playing with XML data in a text file. Just some general stuff.
I played around with xml.etree
and its commands, but now I am wondering how to get rid of the tags manually and write all that data into a new file.
I figure it would take a lot of str.split
s or a loop to get rid of the tags.
I right now have this to start (not working, just copies the data):
def summarizeData(fileName):
readFile = open(fileName, "r").read()
newFile = input("")
writeFile = open(newFile, "w")
with open(fileName, "r") as file:
for tags in file:
Xtags = tags.split('>')[1].split('<')[0]
writeFile.write(readFile)
writeFile.close
So far it just copies the data, including the tags. I figured splitting the tags would do the trick, but it seems like it doesn't do anything. Would it be possible to do manually, or do I have to use xml.etree?