Problem with readlines() and uml

Discussion in 'Python' started by wscrsurfdude, Jul 26, 2006.

  1. wscrsurfdude

    wscrsurfdude Guest

    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.
     
    wscrsurfdude, Jul 26, 2006
    #1
    1. Advertising

  2. 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 ''.split('@')])"
     
    Bruno Desthuilliers, Jul 26, 2006
    #2
    1. Advertising

  3. wscrsurfdude

    wscrsurfdude Guest

    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.
     
    wscrsurfdude, Jul 26, 2006
    #3
  4. On 26 Jul 2006 04:55:37 -0700, 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


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

    --
    Cheers,
    Simon B,
    ,
    http://www.brunningonline.net/simon/blog/
     
    Simon Brunning, Jul 26, 2006
    #4
  5. 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 ''.split('@')])"
     
    Bruno Desthuilliers, Jul 26, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stefan Siegl

    [OT] UML question / UML newsgroup

    Stefan Siegl, Sep 6, 2004, in forum: Java
    Replies:
    0
    Views:
    557
    Stefan Siegl
    Sep 6, 2004
  2. Rogue Chameleon
    Replies:
    0
    Views:
    486
    Rogue Chameleon
    Oct 18, 2004
  3. Richard
    Replies:
    5
    Views:
    322
    Hari Pulapaka
    Aug 13, 2004
  4. rtilley
    Replies:
    2
    Views:
    293
    Kent Johnson
    Feb 14, 2006
  5. Replies:
    3
    Views:
    269
Loading...

Share This Page