Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Problem with readlines() and uml

Reply
Thread Tools

Problem with readlines() and uml

 
 
wscrsurfdude
Guest
Posts: n/a
 
      07-26-2006
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.

 
Reply With Quote
 
 
 
 
Bruno Desthuilliers
Guest
Posts: n/a
 
      07-26-2006
wscrsurfdude wrote:
> 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.

--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '(E-Mail Removed)'.split('@')])"
 
Reply With Quote
 
 
 
 
wscrsurfdude
Guest
Posts: n/a
 
      07-26-2006
Sorry it is so hot in here, I make mistakes, I meant it to be an xml
file. But still sthe same problem

wscrsurfdude wrote:
> Ik have an xml 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 xml headings. Is there
> a solution which also gives the uml headings.


 
Reply With Quote
 
Simon Brunning
Guest
Posts: n/a
 
      07-26-2006
On 26 Jul 2006 04:55:37 -0700, wscrsurfdude <(E-Mail Removed)> wrote:
> Sorry it is so hot in here, I make mistakes, I meant it to be an xml
> file. But still sthe same problem


Check out elementtree - <http://effbot.org/zone/element-index.htm>.

--
Cheers,
Simon B,
http://www.velocityreviews.com/forums/(E-Mail Removed),
http://www.brunningonline.net/simon/blog/
 
Reply With Quote
 
Bruno Desthuilliers
Guest
Posts: n/a
 
      07-26-2006
wscrsurfdude wrote:

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


>
>>Ik have an xml 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 xml headings.


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.

--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '(E-Mail Removed)'.split('@')])"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[OT] "UML for Java Programmers" or "UML Distilled" Rogue Chameleon Java 0 10-18-2004 02:27 PM
[OT] UML question / UML newsgroup Stefan Siegl Java 0 09-06-2004 08:40 AM
Someone know any real Java and UML project merk Java 5 07-10-2004 07:57 PM
Model Driven Integration and UML bruce phipps Java 1 07-08-2004 07:13 PM
UML and APIs using Java interfaces Calum MacLean Java 3 07-03-2003 03:42 PM



Advertisments