On 04/11/2011 07:50 PM, Karim wrote:
On 04/11/2011 10:04 AM, tee chwee liong wrote:
hi Peter,
thanks for your reply. seems that xml doesnt accept a space in between.
anyway, the output generated is:
*-*
*-*
** *2*
** *3*
**
**
it overwrites every time the port number is incremented and
On 04/11/2011 10:04 AM, tee chwee liong wrote:
hi Peter,
thanks for your reply. seems that xml doesnt accept a space in between.
anyway, the output generated is:
*-*
*-*
** *2*
** *3*
**
**
it overwrites every time the port number is incremented and only
capture the last iteration numb
tee chwee liong wrote:
>
> sorry for lack of details. yes i would like to output in 1 xml file.
> i would like to generate port 1 and its details (link, speed etc) then
> move to second port, port 2 and generate its details (link, speed etc) tq
As I said, instead of creating a new root on every
hi peter,
yes it worked after i moved the root outside the for loop.
code:
import elementtree.ElementTree as ET
lspeed=2
tspeed=3
f=open("out.txt", "w")
root = ET.Element("Test")
for port in range (1,9):
print "Port %d" %port
#root = ET.Element("Test")
f.write("Port %d\n" %port)
> Do you want them all in one file? Move the code to create the root element
> and the code to write the file out of the loop.
>
> Do you want to write multiple files? Use a different name from every file.
>
yes i would like to generate 1 xml file by incrementing the port number in the
range
011 10:39:48 +0200
> Subject: Re: [Tutor] Generating XML using Python
>
> tee chwee liong wrote:
>
> > thanks for your reply. seems that xml doesnt accept a space in between.
> > anyway, the output generated is:
> >
> > -
> >
> >
> > -
&g
tee chwee liong wrote:
> thanks for your reply. seems that xml doesnt accept a space in between.
> anyway, the output generated is:
>
> -
>
>
> -
>
>
> 2
>
> 3
>
>
>
> it overwrites every time the port number is incremented and only capture
> the last iteration number. how can
hi Peter,
thanks for your reply. seems that xml doesnt accept a space in between.
anyway, the output generated is:
-
-
2
3
it overwrites every time the port number is incremented and only capture the
last iteration number. how can i modify it to capture all the iteration
tee chwee liong wrote:
> i'm using python to generate xml with elementtree api. and i'm getting
> error when opening the output xml. it doesnt give error when running. i
> also tried to use python to output to a text file and it works without any
> error. Pls advise me how i can rectify the error
hi,
i'm using python to generate xml with elementtree api. and i'm getting error
when opening the output xml. it doesnt give error when running.
i also tried to use python to output to a text file and it works without any
error. Pls advise me how i can rectify the error when opening the out
10 matches
Mail list logo