I'm currently working on a non-python project, and I'm trying to overcome a
task of parsing a text file into a database and/or xml file. I've managed to
find a parser example written in python, and I'm hoping to deconstruct the
code methodology a bit so I can write it in another language. So I'm hoping
someone can explain to me what these following bits of code are doing.
lines = range(data.count("\n"))
lined_data = data.split("\n")
print "Read %i vendors, now processing" % data.count("(hex)")
I've not used the split() function before, but it partly makes sense to me.
What is that piece of code doing? 'Data' is the content of the text file,
presumably the first line there is counting the number of lines in the file,
but I don't get the rest of it.
The rest of the code seems like a relatively simple set of loops, but it's
just this splitting stuff that's got me confused.
-------------- next part --------------
An HTML attachment was scrubbed...