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
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
proxy']
>>> do_stuff_with_urllib2()
--
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
[Paul]
> tell us how the software compares to stuff like Lucene or Xapian.
+1
--
Richie
--
http://mail.python.org/mailman/listinfo/python-list
[Bruce]
> VB programmer!? Thats really harsh..
No offence intended! 8-)
--
Richie
--
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",
e /usr/bin/python is correct for your hosting environment?
--
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
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
:'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
.
req.write(str(meld)) ?
--
Richie Hindle
[EMAIL PROTECTED]
--
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
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
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.
[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
#x27;, '__reduce_ex__', '__repr__',
'__setattr__', '__str__']
>>> class C(object): pass
...
>>> c = C()
>>> dir(c)
['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__
d in english, but in french it's (well - it
> was last time I used MS Word, which is quite some times ago???) "fusion
> de documents".
"Mail Merge"?
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
[Antal]
> is there something wrong with django's website (djangoproject.com)
> or I have problems?
> It looks ugly, the css files can't be found, I even cannot download
> the source from there.
It's broken for me too, so it's not a problem at your end.
--
mpare these lits and generate a third list after
> comparison
>
> list3 would be ["apple", "banana","grape","orange", "pear"]
Use sets:
>>> from sets import Set as set # For compatibility with Python 2.3
>>> one = ["app
[Fredrik]
> oops. thought you were using ctypes, not the pythonwin extensions.
Even when I'm using ctypes I use win32con for the constants, unless
there's some special reason why I need the code to be independent of
pywin32.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://ma
arch?q=ShowWindow+site%3Amsdn.microsoft.com
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
[Etayki]
> How do I get SW_MAXIMIZE to be defined?
It's in win32con. Like this:
>>> from win32con import *
>>> SW_MAXIMIZE
3
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
[Johhny]
> I am trying to get the user that is running the scripts uid, I have had
> a look at the pwd module and it does not appear to offer that
> functionality. Is there any way within python to get that information ?
It's in the 'os' module:
>>> import o
ict.dtd";>
Test
http://somewhere.com?a=1&b=2";>link
saying "cannot generate system identifier for general entity "b" [...] The
most common cause of this error is unencoded ampersands in URLs".
--
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()
uite reasonable
and explains why I couldn't find it.)
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
, 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
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
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
[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_
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
s to the other (in theory at
least 8-)
--
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
xes
> up the mismatching tags.
Great! Many thanks.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
[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!"
[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
; 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
[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.
[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
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
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
[rbt]
> What is the most efficient way to recursively remove files and directories?
shutil.rmtree: http://docs.python.org/lib/module-shutil.html#l2h-2356
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
module urllib:
unquote(s)
unquote('abc%20def') -> 'abc def'.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
arison doesn't hold up.
[1] http://www.linux-m32r.org/lxr/http/source/COPYING
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
pass
>
> remove_file_type(sysroot, ['.tmp', '.TMP'])
def remove_file_type(target_dir, file_type):
[...]
if os.path.splitext(f)[1].lower() == file_type.lower():
pass
remove_file_type(sysroot, '.tmp')
--
R
t give those
improvements back to the community. But the Python license allows for this
too, and Python hasn't suffered for it. IMO choosing a BSD license will get
you more users than GPL, and the benefits of that will outweigh the
potential downside.
--
Richie Hindle
[EMAIL PROTECTED]
-
> But can it change "Fn" key mapping?
I don't think so, no. There's no obvious user interface for that, anyway.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
leaves us with one
> thing, we may have gotten a string that used \r for newlines
Ah, OK. Your comment talks about DOS - that won't happen on DOS (or
Windows) which uses \r\n. I don't know about the Mac. But the \r\n pair
isn't handled by your code - strip() on the serve
exible ways. You can still use the
Windows key as a modifier (as in Windows+E for Explorer).
No affiliation other than as a happy customer.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
[David]
> I'm trying to write something with the same brevity
> as perl's one-liner
>
> eval "\$$1=\$2" while @ARGV && $ARGV[0]=~ /^(\w+)=(.*)/ && shift;
import sys, re
for arg in sys.argv[1:]:
if re.match(r'\w+=.*', arg):
the user has typed a newline? I'd ditch that
code and do it at the server end:
expr = expr[4:].strip()
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
[Steve]
> Since Python is Turing-complete
Is there some equivalent of Godwin's Law that we can invoke at this
point? 8-)
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
or,
but if this doesn't help then at least you'll have narrowed it down to
999,999. 8-)
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
isB)
> False(should be true!)
Slow down. The intersection of A and B is [2, 5, 9].
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
[Shi]
> Yes, i am using python 2.3,
> I have used from sets import *
> but still report the same error:
> > > Traceback (most recent call last):
> > > File "", line 1, in ?
> > > NameError: name 'set' is not defined
It's 'Set&
[ss2003]
> I am stuck at above after doing a lot of f.write for every line of HTML
> . Any betterways to do this in python?
See the "Templating Engines" section of
http://wiki.python.org/moin/WebProgramming - I hope you have a few hours to
spare! 8-)
--
Richie Hindle
[ale.of.ginger]
> WConio.gotoxy(10,10)
> error: GetConOut Failed
Are you running at a Windows Command Prompt, or in an IDE? As I understand
it, WConio will only work in a Windows Command Prompt.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
"ctypes", 0);
You use "windll" for stdcall functions (eg. the Windows API) and "cdll" for
cdecl functions. I don't know which one VB defaults to. If you get it
wrong, ctypes will give you an error talking about using the "wrong calling
convention".
ntrols. I
> wish it were otherwise.
It *is* otherwise. You should follow the Ajaxian weblog here:
http://www.ajaxian.com/
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
s_phishing_defense.html
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
n English.
Split nominatives like "the green tomato" are also impossible in Latin, but
no-one seems to object to their use in English.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
mpossible -- in Latin is no reason to forbid
> them in English.
Your previous post to this thread was chock-full of split nominatives: "The
Hollywood voice", "the specific regional accent", "the English-speaking
world", "the original French". And you call
[Mike]
> Is there a python library, that is able to create Excel files with
> unicode characters.
pyExcelerator claims to do this, but I've never used it.
http://sourceforge.net/projects/pyexcelerator/
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/list
[Andrew]
> Is it just me, or does python-list@python.org not send with a Reply-
> To header?
It's not just you. I don't get one either.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
t rather than the real thing. Try this:
>>> import cgkit
>>> print cgkit.__file__
>>> dir(cgkit)
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
evaluates C; if it is true, A is evaluated to give the
> result, otherwise, B is evaluated to give the result.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ared that particular piece of
> small-mindedness with the group. In the end our most valuable
> contributions to groups like this can be the gift of being able to walk
> away from a fight simply to keep the noise level down.
+1 (and +1 QONW).
--
Richie Hindle
[EMAIL PROTECTED]
--
h
[Peter]
> http://www.pick.ucam.org/~ptc24/yvfc.html
[fraca7]
> print ''.join(map(lambda x: chrord(x) - ord('a')) + 13) % 26) +
> ord('a')), 'yvfc'))
Ah! Or more easily, Edit / Apply ROT13. Thanks!
--
Richie Hindle
[EMAIL PROTECTED]
-
[Peter]
> http://www.pick.ucam.org/~ptc24/yvfc.html
[Jeff]
> Yuma Valley Agricultural Center?
> Yaak Valley Forest Council?
I went through the same process. My guess is "Yes, Very F'ing Clever."
Peter?
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ssibly triple-distilled evil, depending on your point of view. 158 lines
very well spent either way!
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
edia.org/wiki/Greenspun's_Tenth_Rule
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
e "bike shed effect":
http://linuxmafia.com/~rick/lexicon.html#bikeshed
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
[Miklos]
> The ring of the friendly serpent in business suite: Python, Zope, Plone
> http://www.jegenye.com/
Did you mean "business suit"?
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
iles:
C:\> d:
D:\> cd \python23
D:\> python d:\python23\socket6.py > out.txt 2> err.txt
Does anything appear in d:\python23\out.txt or d:\python23\err.txt?
[Dennis]
> I'd be tempted to blame the VBS script then...
n00m, can you post the vbs?
--
Richie Hindle
[EMAI
[Alan]
> SpamBayes has won the Personal Computer World (pcw.co.uk) Editors Choice
> award for anti-spam software
Yay! Do we get one of those cheesy medals to put on our website? 8-)
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
wing: d:\python23\python d:\python23\socket6.py [Enter]
3. Double-click your .vbs file in Windows Explorer.
Now what does the python Command Prompt say? By your description above,
it sounds like it disappears, but that ought to be impossible.
--
Richie Hindle
[EMAIL PROTECTED]>
--
http://mail.python.org/mailman/listinfo/python-list
le information. Please
post:
o The command you're typing into the command prompt
o The error message you're getting
o The full traceback
o The code you're trying to run, or if it's too big then the piece that
the last line of the traceback refers to
Thanks,
--
Richie Hind
[n00m]
> WHY ON THE EARTH <'module' object has no attribute 'AF_INET'> ???
Because you have a socket.py in d:\python23\00 which is being picked up
instead of Python's own socket module. You shouldn't give your modules
the same name as Python's own
FCFC-4016-9D36-14DAA948A600}',
u'\\Device\\NPF_{62280C1D-DC5C-42AF-BA0F-6BDB48418CA5}']
I'm using WinPcap 3.0. My packet.dll is stamped as version 3.0.0.18.
Maybe you're running a different version?
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
these
days that's not difficult. (NB. entrian.com is not running on it yet.)
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
IP connection should never send two
consecutive small packets without receiving a packet from the other end.
('Small' typically means less than about 1400 bytes.) Each time you do
that, you'll suffer an artificial delay introduced by TCP/IP itself.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
[Steve]
> While cheeseshop might resonate with the Monty Python fans I have to
> say I think the name sucks in terms of explaining what to expect. If I
> ask someone where I can find a piece of code and the direct me to the
> cheese shop, I might look for another language.
+1
--
R
Xah Lee explode with fury).
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
[Harald]
> Always go to bed exactly when you want to write the first lambda.
[Peter]
> Eureka. The Twentieth Pythonic Thesis has finally surfaced.
+1 QOTW.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
or binaries provided you ship the source as well.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
rface to scanners, digital
cameras and other devices which implement TWAIN, for the Windows
platform. It provides the functionality to allow a Python
application to connect to the scanner/camera and to retrieve images
from that device."
--
Richie Hindle
[EMAIL PROTECTED]
--
ichie (Nationality: West Yorkshire 8-)
(Having a daughter has improved my speech - I'm much more careful about
enunciating my words properly so that she doesn't pick up my bad habits.)
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ll in there in the system menu, doesn't it? Talk
> about blindness...
Me too!
Many thanks, Bengt.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
In fact, the
> code generated by MinGW-GCC 3.4.4 outpaces that generated by MSVC++ 6.0
> by a considerable margin in some of my performance-critical extensions,
> and the size of the binaries is often smaller.
Interesting!
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/
[Gary]
> I recenly built a C API Python extension for Python 2.3
> on OS X, and now I need to build it for Windows. Will
> [MS Visual Studio Pro 6.0] do the trick?
Yes. That's exactly the compiler that Python 2.3 itself, and most 2.3
extensions, were built with.
--
Richie
ay
to scroll a Command Prompt window using the keyboard?
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
n their site about the architecture (other than a list of credits that
includes ctypes, win32all, Macromedia and SciTE|Flash).
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
[Dave Brueck]
> Please keep the discussion civil; please help keep c.l.py a nice place to
> visit.
+1
--
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
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
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
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
,'
>>> 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
t
someone else has solved it but without saying *how*.
--
Richie Hindle
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
1 - 100 of 140 matches
Mail list logo