Problem with readlines() and uml

W

wscrsurfdude

Ik have an uml file I want to read with readlines. I have the following
code:
infile = open("out2.txt","r")
for line in infile.readlines():
print line

The print statement just gives the data, not the uml headings. Is there
a solution which also gives the uml headings.
 
B

Bruno Desthuilliers

wscrsurfdude said:
Ik have an uml file

What is an "uml file" ?
I want to read with readlines. I have the following
code:
infile = open("out2.txt","r")
for line in infile.readlines():
print line

The print statement just gives the data,

You get what can be read from the file when opened as a text file and
read line by line. Be sure that neither file.readlines() nor print won't
invent data that are not in the file.
not the uml headings. Is there
a solution which also gives the uml headings.

If they're not in the file, obviously, no - whatever "uml heading" might
be.
 
W

wscrsurfdude

Sorry it is so hot in here, I make mistakes, I meant it to be an xml
file. But still sthe same problem
 
B

Bruno Desthuilliers

wscrsurfdude said:
Sorry it is so hot in here, I make mistakes, I meant it to be an xml
file. But still sthe same problem

Still the same question : what is an "xml heading" ? xml is a textual
markup language. It has elements ('tags') which can have content and
attributes - but nothing like "headings".

file.readlines() iterates over lines of a opened text file - it doesn't
give a damn about what this text is, xml, python code, csv or whatever.
If your file contains xml and you want to interpret the xml, you have to
use a xml parser.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top