[Tutor] doc string format ?

2008-06-08 Thread dave selby
Hi All,

I am trying to improve my code quality and have started using doc
strings. What format do you guys use for your doc strings ?
I have 'made up' the following general format ...

Cheers

Dave



def gen_vhost(kmotion_dir):
"""
Generate the kmotion vhost file from vhost_template expanding %directory%
strings to their full paths as defined in kmotion.rc

arguments :
kmotion_dir ... the 'root' directory of kmotion

exceptions:
exit ... if kmotion.rc cannot be read

returns:
"""
parser = ConfigParser.SafeConfigParser()
parsed = parser.read('%s/core/kmotion.rc' % kmotion_dir)
try:
images_dbase_dir = parser.get('dirs', 'images_dbase_dir')
port = parser.get('misc', 'port')
LDAP_enabled = parser.get('LDAP', 'enabled') in ['true',
'True',  'yes',  'Yes']
LDAP_url = parser.get('LDAP', 'AuthLDAPUrl')
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):

-- 

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] zip and rar files

2008-06-08 Thread Dinesh B Vadhia
the zipfile module does work or rar zip archives.


- Original Message - 
From: Dinesh B Vadhia 
To: tutor@python.org 
Sent: Saturday, June 07, 2008 8:27 AM
Subject: zip and rar files


Does the Python zipfile module work on rar archives?  If not, does a similar 
module exist for rar archives?

Dinesh
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Why not to use include?

2008-06-08 Thread Dotan Cohen
I am moving a website from php to python gradually. The first step is
replacing the page headers and footers. Currently, each page begins
with  which contains the  porton
of the html and the html code to present the website name and logo.
Each page ends with  which includes a
footer note and the closing body and html tags. Of course this is a
generalization, but the point is that I need to do something similar
in Python. Python discourages the use of includes, and I would like to
know why so that I can either rethink my page strategy, or decide to
go against the 'recommended practices'. Please enlighten me. Thanks.

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] doc string format ?

2008-06-08 Thread Kent Johnson
On Sun, Jun 8, 2008 at 4:54 AM, dave selby <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I am trying to improve my code quality and have started using doc
> strings. What format do you guys use for your doc strings ?

PEP 257 has some general recommendations:
http://www.python.org/dev/peps/pep-0257/

The standard library has lots of examples.

> I have 'made up' the following general format ...

>"""
>Generate the kmotion vhost file from vhost_template expanding %directory%
>strings to their full paths as defined in kmotion.rc
>
>arguments :
>kmotion_dir ... the 'root' directory of kmotion
>
>exceptions:
>exit ... if kmotion.rc cannot be read
>
>returns:
>"""

If you are going to use a structured format you might consider a
format recognized by a documentation generator such as epydoc:
http://epydoc.sourceforge.net/
http://epydoc.sourceforge.net/relatedprojects.html

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Why not to use include?

2008-06-08 Thread Kent Johnson
On Sun, Jun 8, 2008 at 6:46 AM, Dotan Cohen <[EMAIL PROTECTED]> wrote:
> I am moving a website from php to python gradually. The first step is
> replacing the page headers and footers.

I'm not sure how you plan to do this. PHP programs are embedded into
web pages. Python web programs output the contents of the web page.
This is pretty different.

> Currently, each page begins
> with  which contains the  porton
> of the html and the html code to present the website name and logo.
> Each page ends with  which includes a
> footer note and the closing body and html tags. Of course this is a
> generalization, but the point is that I need to do something similar
> in Python. Python discourages the use of includes

Python doesn't have anything that functions like an include to
incorporate a literal block of text from an external file. I guess you
could call that discouragement

> , and I would like to
> know why so that I can either rethink my page strategy, or decide to
> go against the 'recommended practices'.

You should probably find a Python template package that uses syntax
similar to PHP. There is a comparison of three modern template
packages here:
http://lucumr.pocoo.org/cogitations/2008/01/01/python-template-engine-comparison/

A more complete list is here:
http://wiki.python.org/moin/Templating?highlight=%28genshi%29

If your website is complex you might also want to consider a full web
framework such as Django or TurboGears.

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Why not to use include?

2008-06-08 Thread Dotan Cohen
2008/6/8 Kent Johnson <[EMAIL PROTECTED]>:
> On Sun, Jun 8, 2008 at 6:46 AM, Dotan Cohen <[EMAIL PROTECTED]> wrote:
>> I am moving a website from php to python gradually. The first step is
>> replacing the page headers and footers.
>
> I'm not sure how you plan to do this. PHP programs are embedded into
> web pages. Python web programs output the contents of the web page.
> This is pretty different.

Very little of the pages are PHP, most is HTML. I understand that
Python can be used as a web scripting language, so I assume that
Python can be run in Apache from a page with an .html extension. Is
this not the case, with an .httaccess directive?

>> Currently, each page begins
>> with  which contains the  porton
>> of the html and the html code to present the website name and logo.
>> Each page ends with  which includes a
>> footer note and the closing body and html tags. Of course this is a
>> generalization, but the point is that I need to do something similar
>> in Python. Python discourages the use of includes
>
> Python doesn't have anything that functions like an include to
> incorporate a literal block of text from an external file. I guess you
> could call that discouragement

Could I do something similar with a function? Something like
printHeader() and I would define that function in a class?

>> , and I would like to
>> know why so that I can either rethink my page strategy, or decide to
>> go against the 'recommended practices'.
>
> You should probably find a Python template package that uses syntax
> similar to PHP. There is a comparison of three modern template
> packages here:
> http://lucumr.pocoo.org/cogitations/2008/01/01/python-template-engine-comparison/
>
> A more complete list is here:
> http://wiki.python.org/moin/Templating?highlight=%28genshi%29

Thanks, I will go through those.

> If your website is complex you might also want to consider a full web
> framework such as Django or TurboGears.

Since half the reason for the website to exist is for me to learn to
program (just for fun) then I would rather not use an existing
framework. Thanks for the suggestion, though.

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] doc string format ?

2008-06-08 Thread Marilyn Davis
On Sun, June 8, 2008 1:54 am, dave selby wrote:

> Hi All,
>
>
> I am trying to improve my code quality and have started using doc
> strings. What format do you guys use for your doc strings ? I have 'made
> up' the following general format ...

Your made-up format looks good.  It's great that you give thought to it.

I've seen the style-guide where it is suggested that the first line of the
doc string for a function is a very short description, starting with a
verb, like you did.  That description should fit on one line.

Then there's a blank line.

Then there's the bigger explanation, calling instructions, return values,
exceptions raised, copyright notice, maybe.

A good thing is to type help("your_module") in the interpreter so that you
can see if you like the doc string and if it meshes nicely with what the
help facility provides for free.

But, mostly, I have to say that your instinct is good.

Marilyn Davis

>
> Cheers
>
>
> Dave
>
>
>
>
> def gen_vhost(kmotion_dir): """
> Generate the kmotion vhost file from vhost_template expanding %directory%
> strings to their full paths as defined in kmotion.rc
>
> arguments : kmotion_dir ... the 'root' directory of kmotion
>
> exceptions:
> exit ... if kmotion.rc cannot be read
>
> returns:
> """
> parser = ConfigParser.SafeConfigParser() parsed =
> parser.read('%s/core/kmotion.rc' % kmotion_dir) try:
> images_dbase_dir = parser.get('dirs', 'images_dbase_dir') port =
> parser.get('misc', 'port') LDAP_enabled = parser.get('LDAP', 'enabled') in
> ['true',
> 'True',  'yes',  'Yes']
> LDAP_url = parser.get('LDAP', 'AuthLDAPUrl')
> except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
> 
> --
>
>
> Please avoid sending me Word or PowerPoint attachments.
> See http://www.gnu.org/philosophy/no-word-attachments.html
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] handling MIDI in python

2008-06-08 Thread amit sethi
Can someone tell me about the libraries that can handle MIDI files and also
is their a way in which I can convert an mp3 and wav file into a Midi file
within a python program

-- 
A-M-I-T S|S
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Why not to use include?

2008-06-08 Thread Andreas Kostyrka
On Sunday 08 June 2008 17:13:21 Dotan Cohen wrote:
> 2008/6/8 Kent Johnson <[EMAIL PROTECTED]>:
> > On Sun, Jun 8, 2008 at 6:46 AM, Dotan Cohen <[EMAIL PROTECTED]> wrote:
> >> I am moving a website from php to python gradually. The first step is
> >> replacing the page headers and footers.
> >
> > I'm not sure how you plan to do this. PHP programs are embedded into
> > web pages. Python web programs output the contents of the web page.
> > This is pretty different.
>
> Very little of the pages are PHP, most is HTML. I understand that
> Python can be used as a web scripting language, so I assume that
> Python can be run in Apache from a page with an .html extension. Is
> this not the case, with an .httaccess directive?

Generally no.

Furthermore, Python is pretty bad language to embed in HTML, as whitespace is 
significant in Python.

>
> >> Currently, each page begins
> >> with  which contains the  porton
> >> of the html and the html code to present the website name and logo.
> >> Each page ends with  which includes a
> >> footer note and the closing body and html tags. Of course this is a
> >> generalization, but the point is that I need to do something similar
> >> in Python. Python discourages the use of includes
> >
> > Python doesn't have anything that functions like an include to
> > incorporate a literal block of text from an external file. I guess you
> > could call that discouragement
>
> Could I do something similar with a function? Something like
> printHeader() and I would define that function in a class?

Consult http://wiki.python.org/moin/WebProgramming first, please ;)

Andreas


signature.asc
Description: This is a digitally signed message part.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Why not to use include?

2008-06-08 Thread Kent Johnson
On Sun, Jun 8, 2008 at 11:13 AM, Dotan Cohen <[EMAIL PROTECTED]> wrote:
> Very little of the pages are PHP, most is HTML. I understand that
> Python can be used as a web scripting language, so I assume that
> Python can be run in Apache from a page with an .html extension. Is
> this not the case, with an .httaccess directive?

Maybe you want Python Server Pages?
http://www.modpython.org/live/current/doc-html/pyapi-psp.html

>
>>> Currently, each page begins
>>> with  which contains the  porton
>>> of the html and the html code to present the website name and logo.
>>> Each page ends with  which includes a
>>> footer note and the closing body and html tags. Of course this is a
>>> generalization, but the point is that I need to do something similar
>>> in Python.

 Maybe the parse() function in PSP would do this.

> Could I do something similar with a function? Something like
> printHeader() and I would define that function in a class?

Yes, probably. You don't need to put it in a class, though.

There are many different ways to create web pages in Python and  the
answers to your questions will be different depending on which method
you choose so it's hard to be specific here.

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] handling MIDI in python

2008-06-08 Thread Anthony Parks
regarding conversion between wav and midi, ive looked into it. like the
following article says, you can't.
http://www.hitsquad.com/smm/news/9903_101/

i mean, it is possible, but wav and midi are fundamentally different things.
midi files contain commands that play sounds based on software synthesizers
or synthesizers controlled by external devices, while wav files play
recordings. a midi file doesn't have any sound in it, just commands.

now its possible to analyze a recording and break it down into a composition
of different notes that could generate a midi file, but this is insane and
kudos to the few developers who have been able to design such software.

On Sun, Jun 8, 2008 at 1:40 PM, amit sethi <[EMAIL PROTECTED]>
wrote:

>
> Can someone tell me about the libraries that can handle MIDI files and also
> is their a way in which I can convert an mp3 and wav file into a Midi file
> within a python program
>
> --
> A-M-I-T S|S
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Why not to use include?

2008-06-08 Thread Dotan Cohen
2008/6/8 Andreas Kostyrka <[EMAIL PROTECTED]>:
>> Very little of the pages are PHP, most is HTML. I understand that
>> Python can be used as a web scripting language, so I assume that
>> Python can be run in Apache from a page with an .html extension. Is
>> this not the case, with an .httaccess directive?
>
> Generally no.

Oh.

> Furthermore, Python is pretty bad language to embed in HTML, as whitespace is
> significant in Python.

That is one of the things that drew me to Python, actually. I like the
indentation structure and in any case I structure my PHP code with
indentation as well as {}.

>> Could I do something similar with a function? Something like
>> printHeader() and I would define that function in a class?
>
> Consult http://wiki.python.org/moin/WebProgramming first, please ;)

Thank you!

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Why not to use include?

2008-06-08 Thread Dotan Cohen
2008/6/8 Andreas Kostyrka <[EMAIL PROTECTED]>:
>> Very little of the pages are PHP, most is HTML. I understand that
>> Python can be used as a web scripting language, so I assume that
>> Python can be run in Apache from a page with an .html extension. Is
>> this not the case, with an .httaccess directive?
>
> Generally no.

If this is not the case, then why are there so many "PHP vs. Python"
flame wars? PHP is designed for _only_ programming web pages, so far
as I understand, so if Python cannot do that why are the two languages
compared so often?

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Adding ctypes to an application with python 2.2

2008-06-08 Thread S. Doron
Hello, I'm new to this list. What I'd like to do is add support for pointers
to an old version of python (2.2) in an existing application (a game).
Searching around the web, I found the ctypes module which is supposed to add
this capability to python. However, I didn't quite understand if and how
this could be added (installed) to an existing application which uses
python.
Alternatively, if it's possible (or easier) to just replace the preexisting
version of python with 2.5 by messing around with the dll's somehow,
instructions on how to do so would be welcome.

Some background information - I'm somewhere between a novice and an
intermediate programmer (took intro to C course in university, some
highschool programming, and online python tutorials), but have little
experience in interfacing with windows, dlls, files, etc. In case you're
wondering what I need the pointers for, it's for accessing lower-level
functions from the game's console/script files, that aren't otherwise
available (I've used dir() to get a list of object methods).
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Why not to use include?

2008-06-08 Thread Michael Langford
Python makes web pages just fine. There are both embedded technologies
(such as the python server pages Kent mentioned above) and template
engines based on callbacks (such as django's templates, djangos the
whole way, etc).

Its extremely easy to make your own templating engine if you don't
like python server pages yet you like templating. (Using mod_python or
mod_wsgi[recommended] and the substitute function).

I suggest you really give wsgi (and mod_wsgi) a good hard look to
start off with, as its the python web standard now that all the other
toolkits are starting to conform to (or already do).
http://www.wsgi.org/wsgi/

Also, be very careful with memory in web python frameworks. Most php
processes die every time they are invoked from the web. Often python
web frameworks are more persistent then that:
http://blog.ianbicking.org/2008/01/12/what-php-deployment-gets-right/

   --Michael

On Sun, Jun 8, 2008 at 3:14 PM, Dotan Cohen <[EMAIL PROTECTED]> wrote:
> 2008/6/8 Andreas Kostyrka <[EMAIL PROTECTED]>:
>>> Very little of the pages are PHP, most is HTML. I understand that
>>> Python can be used as a web scripting language, so I assume that
>>> Python can be run in Apache from a page with an .html extension. Is
>>> this not the case, with an .httaccess directive?
>>
>> Generally no.
>
> If this is not the case, then why are there so many "PHP vs. Python"
> flame wars? PHP is designed for _only_ programming web pages, so far
> as I understand, so if Python cannot do that why are the two languages
> compared so often?
>
> Dotan Cohen
>
> http://what-is-what.com
> http://gibberish.co.il
> א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
>
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
Michael Langford
Phone: 404-386-0495
Consulting: http://www.RowdyLabs.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Why not to use include?

2008-06-08 Thread Kent Johnson
On Sun, Jun 8, 2008 at 3:14 PM, Dotan Cohen <[EMAIL PROTECTED]> wrote:
> If this is not the case, then why are there so many "PHP vs. Python"
> flame wars? PHP is designed for _only_ programming web pages, so far
> as I understand, so if Python cannot do that why are the two languages
> compared so often?

Python is a general purpose language that can, among other things, be
used to generate web pages in many different ways. Possibly none of
these ways match your pre-conceptions. Please do some reading.

Probably the simplest way to generate a web page from Python is with a
cgi module. Here is a simple example:
http://wiki.python.org/moin/CgiScripts

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Why not to use include?

2008-06-08 Thread Dotan Cohen
2008/6/8 Michael Langford <[EMAIL PROTECTED]>:
> Python makes web pages just fine. There are both embedded technologies
> (such as the python server pages Kent mentioned above) and template
> engines based on callbacks (such as django's templates, djangos the
> whole way, etc).
>
> Its extremely easy to make your own templating engine if you don't
> like python server pages yet you like templating. (Using mod_python or
> mod_wsgi[recommended] and the substitute function).
>
> I suggest you really give wsgi (and mod_wsgi) a good hard look to
> start off with, as its the python web standard now that all the other
> toolkits are starting to conform to (or already do).
> http://www.wsgi.org/wsgi/
>
> Also, be very careful with memory in web python frameworks. Most php
> processes die every time they are invoked from the web. Often python
> web frameworks are more persistent then that:
> http://blog.ianbicking.org/2008/01/12/what-php-deployment-gets-right/
>

Thank you very much, I will keep that in mind. If I do not have root
access, what is the best way to check memory usage? I do have SSH
access, of course.

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Why not to use include?

2008-06-08 Thread Dotan Cohen
2008/6/8 Kent Johnson <[EMAIL PROTECTED]>:
> On Sun, Jun 8, 2008 at 3:14 PM, Dotan Cohen <[EMAIL PROTECTED]> wrote:
>> If this is not the case, then why are there so many "PHP vs. Python"
>> flame wars? PHP is designed for _only_ programming web pages, so far
>> as I understand, so if Python cannot do that why are the two languages
>> compared so often?
>
> Python is a general purpose language that can, among other things, be
> used to generate web pages in many different ways. Possibly none of
> these ways match your pre-conceptions. Please do some reading.
>
> Probably the simplest way to generate a web page from Python is with a
> cgi module. Here is a simple example:
> http://wiki.python.org/moin/CgiScripts
>

I see, it is not exactly what I was expecting. Thanks.

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Extracting text from XML document

2008-06-08 Thread Dinesh B Vadhia
I want to extract text from XML (and SGML) documents.  I found one program by 
Paul Prescod (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65128) 
from 2001.  Does anyone know of any programs that are more recent?  Cheers

Dinesh
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Adding ctypes to an application with python 2.2

2008-06-08 Thread Alan Gauld

"S. Doron" <[EMAIL PROTECTED]> wrote

Hello, I'm new to this list. What I'd like to do is add support for 
pointers
to an old version of python (2.2) in an existing application (a 
game).


What do you mean by "add support for pointers"?
Pointers are a very low level memory specific thing in C.
In Pascal they are a much higher level logical concept.
In Python every variable is a reference to a value, a pointer if you 
like.


So what kind of pointer do you want and why?
What do you intend to do with these pointers?


 I found the ctypes module which is supposed to add
this capability to python.


Not exactly. As the name suggests ctypes allows Python
to access code written in C. On Windows that usually means
code stored in a DLL. It does not add any new pointer
capability to Python itself.

Alternatively, if it's possible (or easier) to just replace the 
preexisting

version of python with 2.5 by messing around with the dll's somehow,
instructions on how to do so would be welcome.


Again, I don't know what replacing 2.2 with 2.5 would give you
that you need?

highschool programming, and online python tutorials), but have 
little
experience in interfacing with windows, dlls, files, etc. In case 
you're
wondering what I need the pointers for, it's for accessing 
lower-level
functions from the game's console/script files, that aren't 
otherwise

available (I've used dir() to get a list of object methods).


OK, that probably does need ctypes which wuill let you access the
functions and convert from the C types to the more usual Python types.
There are some ctypes tutorials and examples around which should help.

Alan G.


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Extracting text from XML document

2008-06-08 Thread Kent Johnson
On Sun, Jun 8, 2008 at 6:39 PM, Dinesh B Vadhia
<[EMAIL PROTECTED]> wrote:
> I want to extract text from XML (and SGML) documents.  I found one program
> by Paul Prescod
> (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65128) from 2001.
> Does anyone know of any programs that are more recent?

That recipe looks pretty good to me. If you need more control (e.g.
extracting text only from specific elements) look at ElementTree (now
in the standard lib).

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor