[EMAIL PROTECTED] wrote:
> Hope this is not too off topic:
> I noticed that the Python in a Nutshell book is version 2.2 and a few
> years old. Does anyone know if there are plans to bring out a new
> edition anytime soon? I checked the O'reilly page and didnt find
> anything, also googled it
Shitiz Bansal wrote:
>try:
> import
>except:
>
> import
>
>
>--- Ed Hotchkiss <[EMAIL PROTECTED]> wrote:
>
>
>
Explicit is always better than implicit...
try:
import
except ImportError:# Only catch import errors
import
Cheers,
F.
_
Kent Johnson wrote:
>Have you looked at Python Cookbook 2E? Chapter 19 is "Iterators and
>Generators". Chapter 20 is "Descriptors, Decorators and Metaclasses".
>
>
I have. But I'd rather have a complete book on these subjects ;-)
I'm sure someone will write one in the end. Hopefully Alex Martel
Damien Gouteux wrote:
> In french, 'Python précis & concis', from O'Reilly is now out : from
> Mark Lutz, it covers python 2.4 (and decorators).
> I assume there is a english edition of this book.
Yes, that's the Python Pocket Reference.
It does have 1 (small) page on decorators, but nothing on
Johan Geldenhuys wrote:
>Hi all,
>
>What is the syntax if I want to work out what percentage 42 is out of 250?
>
>
Johan,
You could try:
percentage = (42 * 250)/100
This gives the answer 105.
Cheers,
F.
___
Tutor maillist - Tutor@python.org
http:
Johan Geldenhuys wrote:
> Wow, you gave 105% on this one. ;-)
>
You're right. I misread the question and thought that you wanted 42% of
250.
My mistake.
Cheers,
F.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Negroup - wrote:
>Hi.
>
>My application hosts a module A that contains only a (variable) number
>of functions. In another part of this application I need to know which
>functions are defined inside module A. Initially I thought to use
>__dict__, but along with the functions of module A are listed
Greg Lindstrom wrote:
> Hello-
> I am in the process of creating an XML document from information
> stored in our database. One of my colleagues will use the record to
> format our information (health care claims) into all sorts of forms,
> reports, etc. He is partial to PHP5 but I like Pytho
Hi,
Can anyone tell me how to do a regex substitution across multiple lines
in HTML?
I can search for the piece of HTML I want to substitute, for instance:
This is my title
using
html_text = file('some.html', 'r').read()
search_string = '.*'
p = re.compile(search_string, re.DOTALL)
But
Kent Johnson wrote:
>Use your compiled regex for the sub(), so it will have the DOTALL flag set:
>html_text = p.sub(replace_string, html_text)
>
>
Kent,
I was trying to work out how to use the DOTALL flag with the sub method,
but couldn't figure it out.
It's so obvious once someone points it o
Hi,
I'm getting the following error when I try and write some HTML with
German text in it.
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in
position 1367: ordinal not in range(128)
This was my code:
html_text = open(inFile, 'r').read()
# ... do some processing on
Kent Johnson wrote:
>Do you explicitly close the output file? If not, the data may not be
>actually written.
>
>
Kent,
You're right, I realised after playing with Tim's example that the
problem was that I wasn't calling close() on the codecs file.
Adding this after the f.write(html_text) seem
Hi,
I need to do some encoding of text that will be used in a web page.
The text has been translated into 16 different languages.
I've managed the manual translation of some of the more regular
languages (French, Spanish, Italian etc...) , by
replacing characters like 'á' with the numeric entity
13 matches
Mail list logo