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
"leechau" wrote
def step1:
local_var1 = ...
# some other variable definitions for step1
def substep11:
pass
# more substeps
...
global_var1 = ...
# more global var definitions...
if step1.return_success:
step2
Since this is obviously pseudo code I'll assume the
real co
"tee chwee liong" wrote
i just started to learn xml using python and i'm getting
error when opening the output xml. it doesnt give error when
running.
Always post full error codes and the asociated source code.
For shorty programs like this its more convenient to include
the text in the bod
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
On 04/10/2011 0.12, Tyler Glembo wrote:
Hi All,
So I have a ~3000 line fortran code that needs to be updated to run new files
by simply updating a few lines in the code (~10
lines). I thought python would be a great way to do so since I know a little
python but not fortran. So, my plan was to
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
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
> To: tutor@python.org
> From: __pete...@web.de
> Date: Mon, 11 Apr 2011 10:39:4
> 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
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)
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 Everyone,
I am a super beginner and am little muddled right now. So I apologize for the
low level question but I am trying to write a function that will return a
dictionary of a given list of strings containing two coordinates separated by a
space with the first numbers as a key and the seco
On Mon, Apr 11, 2011 at 1:01 PM, Sophie DeNofrio wrote:
> Hi Everyone,
>
> I am a super beginner and am little muddled right now. So I apologize for
> the low level question but I am trying to write a function that will return
> a dictionary of a given list of strings containing two coordinates se
On Mon, Apr 11, 2011 at 6:01 AM, Sophie DeNofrio wrote:
> Hi Everyone,
>
> I am a super beginner and am little muddled right now. So I apologize for
> the low level question
>
That's what this list is for, so you're asking in the right place!
> but I am trying to write a function that will retu
Hello Sophie, or do you prefer Annie?
Sophie DeNofrio wrote:
Hi Everyone,
I am a super beginner and am little muddled right now. So I apologize
for the low level question but I am trying to write a function that
will return a dictionary of a given list of strings containing two
coordinates se
Thank you to everyone who helped!
Steven D'Aprano I was secretly hoping you'd help. This is a family not personal
and 'junk' (this isn't junk obviously. But it falls into that not personal
category) account so you are talking to Annie lol. I guess I should have just
signed up using my own email
Hi, I need to know if there is any way to run a python file without Python
installed on the target computer. I am trying to send a program to a friend
using windows and he does not have python installed, and does not want to
take the time to install it. Is there any way to send him the file (or a
Hi all...
is there any way to convert any file (eg: document files & image files) to
.pdf?
if so, kindly share...
thank you in advance.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailma
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
On Mon, 11 Apr 2011 21:01:37 +0800
Mike Silverson wrote:
> Hi, I need to know if there is any way to run a python file without
> Python installed on the target computer. I am trying to send a
> program to a friend using windows and he does not have python
> installed, and does not want to take t
On 4/11/2011 10:40 AM sunil tech said...
Hi all...
is there any way to convert any file (eg: document files & image files)
to .pdf?
Look into reportlab. Look at the opensource area:
http://www.reportlab.com/software/opensource/
if so, kindly share...
thank you in advance.
_
I've just watched the Channel 5 programme "The Gadget Show"
where the presenters set a new Guinness world record for operating
the heaviest machine(*) using mind power. The software behind
this feat - was written in Python of course! :-)
(*)The machine in question was a 50 ton industrial crane...
I use http://cx-freeze.sourceforge.net/ personally. I found py2exe to be a
headache compared to cx.
On Mon, Apr 11, 2011 at 9:01 AM, Mike Silverson wrote:
> Hi, I need to know if there is any way to run a python file without Python
> installed on the target computer. I am trying to send a progra
"Mike Silverson" wrote
installed on the target computer. I am trying to send a program to
a friend
using windows and he does not have python installed, and does not
want to
take the time to install it.
Given how quickly Python installs compared to many other apps I
can only assume he uses
Hi,
Thanks Emile van Sebille for answering my last question.
I'm now testing my imported data and I get 21 errors (see attached). The
majority sounds like:
from wdmmgext.load import uganda
ImportError: No module named wdmmgext.load
I've searched the files that use this module. Attached is
"sunil tech" wrote
is there any way to convert any file (eg: document files & image
files) to
.pdf?
if so, kindly share...
Install a PDF print driver and then print the file to that printer.
Set it to save as a file. Then if its printable you can get it as a
PDF.
You can do the same wit
At least in my case it was about simplicity. If it was a simple matter of
using a base python program, that would be one thing, but the last program
i distributed here at work used pygtk as it's GUI (which at the time
required four different packages, I believe they have consolidated this down
to o
On 4/11/2011 4:20 PM, Alan Gauld wrote:
I've just watched the Channel 5 programme "The Gadget Show"
where the presenters set a new Guinness world record for operating
the heaviest machine(*) using mind power. The software behind
this feat - was written in Python of course! :-)
(*)The machine in
I'm not sure how to do this. I'm reading lines in from a text file.
When I reach the string "notes:", I want to assign the remainder of
the text file to a single variable (line breaks and all):
text
moretext
moretext
notes:
This is the stuff I want in my variable.
And this line should be included
I use Openoffice and it has an option to export your files to .pdf and lots
of other file formats.
It's a free download - and has all the usual Office applications...
Search for 'OpenOffice' online.
On Mon, Apr 11, 2011 at 9:48 PM, Alan Gauld wrote:
>
> "sunil tech" wrote
>
>
> is there any wa
> So right now my code looks something like this:
>
> for line in open('myfile','r'):
> if line.startswith('notes'):
> ## Assign rest of file to variable
>
> Is there an easy way to do this? Or do I need to read the entire file
> as a string first and carve it up from there instead?
I ended
On 4/11/2011 5:14 PM, Sean Carolan wrote:
So right now my code looks something like this:
for line in open('myfile','r'):
if line.startswith('notes'):
## Assign rest of file to variable
Is there an easy way to do this? Or do I need to read the entire file
as a string first and carve it
> At least in my case it was about simplicity. If it was a simple matter of
> using
>
> a base python program, that would be one thing, but the last program i
> distributed here at work used pygtk as it's GUI
Valid comment although its not much more work to build a custom
installer that ins
On Mon, Apr 11, 2011 at 4:24 PM, ALAN GAULD wrote:
> > It doesn't make sense to say, go here, install this, ok, now drop
> > this in this folder, ok now drop this in that folder, ok now open
> > your command prompt and type this string
>
> Agreed, we need to package our apps so the user doesn't n
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
"Sean Carolan" wrote
I ended up doing this, but please reply if you have a more elegant
solution:
if line.startswith('notes'):
break
notes = open('myfile','r').read().split(notes:\n')[1]
The first two lines are redundant you only need the last one.
HTH,
Alan G.
___
>> if line.startswith('notes'):
>> break
>> notes = open('myfile','r').read().split(notes:\n')[1]
>
> The first two lines are redundant you only need the last one.
I should have clarified, the "if line.startswith" part was used to
break out of the previous for loop, which was used to import the
hi,
i'm a bit stuck here. i have a code dict1.py that writes to an xml and another
script parsedict1.py to parse the content of the xml.
when i write it to the xml i wrote it as dictionary but since it can't accept
dict format i convert it to string.
below is output of the parsedict1.py wh
37 matches
Mail list logo