[Adam]
> For the life of me I can't understand why he would troll
> comp.lang.python when comp.lang.lisp is there.
+1 QOTW!
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
the week about Python than comp.lang.python itself.
Point taken... but had Adam said "For the life of me I can't understand why
he would troll comp.lang.python when the rest of usenet is there" I would
have still voted QOTW. It was a pro-comp.lang.python vote, not an
anti-comp.lang.lisp vote.
rce encoding
> directive for correct interpretation of u"..." strings by Python
> interpreter.
So is "# vim: set fileencoding=utf-8". Anything matching
"coding[:=]\s*([-\w.]+)" on the first or second line counts.
> See http://www.python.org/dev/peps/pep
re.match(r'(xx+)\1+$', 'x'*n)
finds prime numbers.
I'll get me coat.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
y
invalid, HTML.)
Incidentally, I'm changing PyMeld's license from Sleepycat to BSD, making it
free for use in closed source projects. (I'll get around to updating the
website RSN 8-)
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
[thakadu]
> The method of generation the table rows was exactly the same as
> the example in the PyMeld documentation
Did you try using toFormatString() to speed it up? See
http://www.entrian.com/PyMeld/doco.html
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/li
[John]
> That particular file doesn't include the implementation files for the core
> modules.
*Which* particular file? Give us a URL. The source tarball at
http://www.python.org/2.4.2/ (full URL
http://www.python.org/ftp/python/2.4.2/Python-2.4.2.tgz) contains the full
source.
.last_line = line
def flush( self ):
if self.line is not None:
sys.stdout.write( self.line )
if __name__ == '__main__':
if len( sys.argv ) != 2:
print __doc__
else:
file = open( sys.argv[ 1 ], 'rt' )
unSpace = UnSpace()
tokenize.tokenize( file.readline, unSpace.onToken )
unSpace.flush()
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
t
someone else has solved it but without saying *how*.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
,'
>>> reader = csv.reader(f, delimiter=Adelimiter)
Traceback (most recent call last):
File "", line 1, in ?
TypeError: bad argument type for built-in operation
>>> print type(Adelimiter)
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
CII NUL characters. Accordingly,
all input should generally be printable ASCII to be safe. These restrictions
will be removed in the future. "
That note is still there in the current development docs, so it looks like
it hasn't yet been fixed.
--
Richie Hindle
[EMAIL PROTECTED]
--
ht
00
http://diveintopython.org/xml_processing/unicode.html
http://www.jorendorff.com/articles/unicode/python.html
The short answer to your question is this:
>>> U = u'My string'
>>> A = U.encode('ascii')
>>> print U, type(U), A, type(A)
My string My
ither forward slash or backslash at the OS
level - it's only the shells (explorer.exe or to a lesser extent cmd.exe)
that don't accept forward slashes.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
and know that your reply was part of the same thread as the message
to which you replied.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
:'016':'AMERICAN SAMOA':'American Samoa'
"""
f1 = StringIO(DATA)
for line in f1:
print repr(line.rsplit(':')[4].strip("'")) # repr shows the error
# This prints:
#
# "Afghanistan'\n"
# "Albania'\n"
# "Algeria'\n"
# "American Samoa'\n"
#
# Do this instead:
f1.seek(0)
for line in f1:
print line.strip().rsplit(':')[4].strip("'")
# This prints:
#
# Afghanistan
# Albania
# Algeria
# American Samoa
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
m
the word for something that lives under a bridge. It derives from "trolling
for suckers" or "trolling for newbies".
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
s would be that you don't have cgitb in your server environment, or
that you have a bogus one. Rearrange things like this:
#!/usr/bin/python
print "Content-Type: text/html"
print
import sys
sys.stderr = sys.stdout
import cgitb; cgitb.enable(display=0, logdir=".")
--
Richie
e /usr/bin/python is correct for your hosting environment?
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
[Bruce]
> f.close()
> cmd = "echo %s | %s"%(argument_file,the_program)
Either: you are a VB programmer and you've actually typed "f.close" rather
than "f.close()",
Or: you meant "type" (or "cat") rather than "echo",
[Bruce]
> VB programmer!? Thats really harsh..
No offence intended! 8-)
--
Richie
--
http://mail.python.org/mailman/listinfo/python-list
[Paul]
> tell us how the software compares to stuff like Lucene or Xapian.
+1
--
Richie
--
http://mail.python.org/mailman/listinfo/python-list
import Meld
LAYOUT = """The Title
The page information goes here.
The real title
Here is the info, which would in the real world
be read from a file."""
page = Meld(LAYOUT)
info = Meld(INFO)
page.title = info.title._content
page.info = info.info._content
print page
Is th
.
req.write(str(meld)) ?
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
and it's a real shame they've had to limit its availability to
North America.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
s to the other (in theory at
least 8-)
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
use "NFKD" to normalize things like LATIN SMALL
LIGATURE FI and subscript/superscript characters as well as diacritics.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
[Luis]
> When I used the "NFD" option, I came across many errors on these and
> possibly other codes: \xba, \xc9, \xcd.
What errors? This works fine for me, printing "Ecoute":
import unicodedata
def search_key(s):
de_str = unicodedata.normalize("NFD", s)
return ''.join([cp for cp in de_
t to "st".
NFKD normalization doesn't convert VULGAR FRACTION ONE QUARTER into
"1/4" - I wonder whether there's some way to do that?
> After all they are called *compatibility* code points.
Yes, compatible with what the user types. 8-)
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
Am I imagining it, or is there a switch or an environment variable to
make Python treat all string literals as unicode? I seem to recall
seeing it mentioned somewhere, but now I can't find it anywhere.
Thanks,
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/lis
, and memory
efficiency. A Judy array is extensible and can scale up to a very large
number of elements, bounded only by machine memory." ... "PyJudy arrays
are similar to Python dictionaries and sets."
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
uite reasonable
and explains why I couldn't find it.)
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
hat you expect to fail with
the given exception. Try this instead:
>>> try:
>>> command = getattr(commands, VARIABLE)
>>> except AttributeError:
>>> print >> sys.stderr, "Unknown command", VARIABLE
>>> else:
>>> command()
proxy']
>>> do_stuff_with_urllib2()
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
sole group.
> a=ipre.finditer(subnetlist)
> >>> a.next().group()
> '192.168.100.0'
Also correct, because match.group() returns the whole of the matched text.
If you wanted just your captured piece, you need this:
> >>> a.next().group(1)
> '100.'
Hope
an't
achieve what you want without modifying Python's grammar (and turning
it into something that isn't Python any more).
--
Richie Hindle
[EMAIL PROTECTED]
Search your Visual Studio projects instantly with Entrian Source Search,
our powerful Source Code Search add-in: http
; get's garbage collected and deleted.
[Steve]
> The "ser" name is still bound to the serial object, surely?
A piece of that code has been chopped off by someone's newsreader - it's the
body of a method, and ser.readline() is the last line of that method.
--
Ri
[Thomas]
> How can I use python to find images that looks quite similar?
Have you looked at http://www.imgseek.net/ ? It's an Open Source Python photo
collection manager that does exactly what you're asking for.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mai
[Daniel]
> You could try HTMLTidy (http://www.egenix.com/files/python/mxTidy.html)
> as a first step to get well formed HTML.
But Tidy fails on huge numbers of real-world HTML pages. Simple things like
misspelled tags make it fail:
>>> from mx.Tidy import tidy
>>> results = tidy("Hello world!"
xes
> up the mismatching tags.
Great! Many thanks.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
[Mystilleef]
> Lists should have a clear method. But what's shocking is that
> it doesn't seem obvious to others. list.clear() is a whole lot more
> readable, intuitive, "flowable" and desirable than [the alternatives]
+1 to all of that.
--
Richie Hind
101 - 140 of 140 matches
Mail list logo