473,511 Members | 10,974 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with readlines() and uml

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.

Jul 26 '06 #1
4 1452
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 'o****@xiludom.gro'.split('@')])"
Jul 26 '06 #2
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.
Jul 26 '06 #3
On 26 Jul 2006 04:55:37 -0700, wscrsurfdude <ma**@holmes.nlwrote:
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,
si***@brunningonline.net,
http://www.brunningonline.net/simon/blog/
Jul 26 '06 #4
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 'o****@xiludom.gro'.split('@')])"
Jul 26 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1827
by: Francis Lavoie | last post by:
I'm new to python and I'm not sure if I use the ftplib class correctly. I made a programm to update a pseudo-dynamic site via ftp. The site is a static html that include files update by ftp. It...
2
6193
by: Yong Wang | last post by:
Hi, I use readlines() to read one data file. Python automatically parses the read contents into a list of lines. When I used list to print out the 1st line, it is ok. When I use the list index 2...
9
29207
by: wordsender | last post by:
Hey guys, I can't figure this one out, why is this simple script giving me problems? logfile=file(r'test.txt','w') logfile.write('datetime') test=logfile.readlines() When I run it I get...
2
4139
by: vch | last post by:
Does a call to file.readlines() reads all lines at once in the memory? Are the any reasons, from the performance point of view, to prefer *while* loop with readline() to *for* loop with readlines()?
34
2759
by: Ross Reyes | last post by:
HI - Sorry for maybe a too simple a question but I googled and also checked my reference O'Reilly Learning Python book and I did not find a satisfactory answer. When I use readlines, what...
8
2339
by: Richard Schulman | last post by:
The following program fragment works correctly with an ascii input file. But the file I actually want to process is Unicode (utf-16 encoding). The file must be Unicode rather than ASCII or...
1
2154
by: MyCGal | last post by:
Hi, I have this code I wrote to copy any length lines into array of pointers. The problem is after storing the individual lines into the char pointer array, the dispaly() chops off some lines...
1
2438
by: NeoGregorian | last post by:
Hello, I am writing a wrapper to a basic Input/Output programs (where you type a one line command at a time and then get 0 or more lines of output before you can input the next command). I'm...
5
6210
by: zxo102 | last post by:
Hello All, I have a system. An instrument attched to 'com1' is wireless connected to many sensors at different locations. The instrument can forward the "commands" (from pyserial's write()) to...
0
7144
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7427
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7512
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.