Re: Regexp problem

2009-07-30 Thread Peter Brett
xps for quite a while with no great success, I learnt the hard (and best) way, i.e. using them to write something vile and horrible. [*] I commend this path to you also. ;-) Cheers, Peter [*] http://git.gpleda.org/?p=gaf.git;a=blob;f=libgeda/desktop-i18n;h=6fab9b85b -- Peter Brett Remote Sensing Research Group Surrey Space Centre -- http://mail.python.org/mailman/listinfo/python-list

Re: Extract the numeric and alphabetic part from an alphanumeric string

2009-08-03 Thread Peter Brett
is this what you wanted to do? >>> p = re.compile(r'^\d+') >>> p.sub('', '123ACTGAAC') 'ACTGAAC' Regards, Peter -- Peter Brett Remote Sensing Research Group Surrey Space Centre -- http://mail.python.org/mailman/listinfo/python-list

Re: expandtabs acts unexpectedly

2009-08-19 Thread Peter Brett
eturned > > Is it a bug or something, please advice. Consider where the 4-space tabstops are relative to those strings: test test testtest ^ ^ ^ So no, it's not a bug. If you just want to replace the tab characters by spaces, use: >>> " test\ttest&quo

Copy Protected PDFs and PIL

2010-11-11 Thread Brett Bowman
dies. An automated way to snap a picture of the PDFs would be ideal, but I'd settle for a way to skip over them without crashing my program. Any tips? Brett Bowman Bioinformatics Associate Cibus LLC -- http://mail.python.org/mailman/listinfo/python-list

Re: Copy Protected PDFs and PIL

2010-11-11 Thread Brett Bowman
Windows currently, though I also have a Linux box running Ubuntu if need be. On Thu, Nov 11, 2010 at 12:28 PM, Brett Bowman wrote: > I'm trying to parse some basic details and a thumbnail from ~12,000 PDFs > for my company, but a few hundred of them are copy protected. To make >

Re: Copy Protected PDFs and PIL

2010-11-12 Thread Brett Bowman
hich prints the following: 1 2 3 4 5 FATAL PDF disallows copying Any help or suggestions would be appreciated. /b/ On Thu, Nov 11, 2010 at 12:28 PM, Brett Bowman wrote: > I'm trying to parse some basic details and a thumbnail from ~12,000 PDFs

Re: [Fwd: Re: hex string to hex value]

2005-11-22 Thread Brett g Porter
42) 66 >>> -- // Today's Oblique Strategy (© Brian Eno/Peter Schmidt): // Repetition is a form of change // Brett g Porter * [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Mutability of function arguments?

2005-12-07 Thread Brett g Porter
erwise". If you're trying to return multiple values from a function, Python lets you do that >>> def multiFoo(x, y, z): ... return x*2, y*2, z*2 ... >>> x = 1 >>> y = 2 >>> z = 3 >>> x, y, z = multiFoo(x, y, z) >>> x 2 >>> y 4 >>> z 6 >>> -- // Today's Oblique Strategy (© Brian Eno/Peter Schmidt): // Repetition is a form of change // Brett g Porter * [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: How to compare files

2005-07-01 Thread Brett g Porter
e > different( eventhough without '\n' are the same) > > Thanks for help. > LAd. > Have you looked at the difflib module that comes with Python? http://docs.python.org/lib/module-difflib.html -- // Today's Oblique Strategy (© Brian Eno/Peter Schmidt): // Change

Re: Defending Python

2005-07-13 Thread Brett g Porter
he "It's" man) in _The First 20 Years of Monty Python_ by Kim "Howard" Johnson (St. Martin's Press, 1989), p.20 -- // Today's Oblique Strategy (© Brian Eno/Peter Schmidt): // Change instrument roles // Brett g Porter * [EMAIL PROTECTED] // http://bgporter.inknoise.com/JerseyPorkStore -- http://mail.python.org/mailman/listinfo/python-list

Re: First Script Problem

2005-09-16 Thread Brett g Porter
ow -- much better to either use string formatting or the idiom of using the join method of list objects to create a string in a single pop once a list of substrings is all populated. -- // Today's Oblique Strategy (© Brian Eno/Peter Schmidt): // Destroy -nothing -the most important thing // Brett g Porter * [EMAIL PROTECTED] // http://bgporter.inknoise.com/JerseyPorkStore -- http://mail.python.org/mailman/listinfo/python-list

Re: Pattern matching with string and list

2005-12-13 Thread Brett g Porter
BartlebyScrivener wrote: > Even without the marker, can't you do: > > sentence = "the fabric is red" > colors = ["red", "white", "blue"] > > for color in colors: > if (sentence.find(color) > 0): > print color, sentence.find(color) > That depends on whether you're only looking for who

Re: URL 'special character' replacements

2006-01-09 Thread Brett g Porter
'/~connolly/'. unquote_plus(string) Like unquote(), but also replaces plus signs by spaces, as required for unquoting HTML form values. -- // Today's Oblique Strategy (© Brian Eno/Peter Schmidt): // Accretion // Brett g Porter * [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: String handling and the percent operator

2006-07-13 Thread Brett g Porter
Justin Azoff wrote: > Tom Plunket wrote: >> boilerplate = \ >> """ > [big string] >> """ >> >> return boilerplate % ((module,) * 3) >> [deletia...] > Of course.. > stuff = {'lang': 'python', 'page': 'typesseq-strings.html'} print """I should read the %(lang)s documentation at

Re: xmlrpclib and methods declared at runtime

2006-07-26 Thread Brett g Porter
but in cases like this where you don't know in advance what the class will need to handle, it lets your code hide the magic in a way that lets the users of your code forget that there's anything magic going on at all. It just looks like code. -- // Brett g Porter * [EMAIL PROTECTED] // http://www.bgporter.net/blog -- http://mail.python.org/mailman/listinfo/python-list

Using PyQT and OpenGL

2006-07-26 Thread Peter TB Brett
Hi folks, Although the PyQt documentation indicates that QGLWidget & friends have been ported to Python for the PyQt bindings, I'm not entirely sure what's necessary to make the normal OpenGL/GLUT interface available. Does PyQt work okay with PyOpenGL? Or is a more complicated workaround needed

Re: do people really complain about significant whitespace?

2006-08-09 Thread Brett g Porter
being consistent). Pushing the scutwork down onto tools is not as good a solution as eliminating the scutwork, especially when it shouldn't be necessary at all... -- // Brett g Porter * [EMAIL PROTECTED] // http://www.bgporter.net/blog -- http://mail.python.org/mailman/listinfo/python-list

Detecting window focus events in PyGTK

2006-08-28 Thread Peter TB Brett
Hi folks, I'm currently trying to work out how to detect when a PyGTK window receives the focus from the window manager -- I assume that it must receive some kind of X event, but I can't work out which signal it generates. Searching around the subject on the web doesn't seem to pull up anything us

Re: How to *Search* with google from inside my programme and get the search result?

2006-02-15 Thread Brett g Porter
I V wrote: > Frank Potter wrote: >> Does google supply some webservice to programmers? I did see > > Googling for "google api" gets you to: > > http://www.google.com/apis/ > > It appears to be a SOAP API, which you can access with python, but I > think you'll need a third-party library. Googling

Re: Python forum

2005-05-17 Thread Brett g Porter
people answering > questions without any problem and it goes very well > > Thanks Don't forget that there's also the Tutor list (see http://www.python.org/mailman/listinfo/tutor ), targeted to people looking to learn the language... -- // Today's Oblique Strategy

Re: Iteration over strings

2007-07-31 Thread Brett g Porter
Robert Dailey wrote: > Hi, > > I have the following code: > > str = "C:/somepath/folder/file.txt" > > for char in str: > if char == "\\": > char = "/" > > The above doesn't modify the variable 'str' directly. I'm still pretty > new to Python so if someone could explain to me why th

Re: Eureka moments in Python

2007-03-13 Thread Brett g Porter
Steven D'Aprano wrote: > I'd be interested in hearing people's stories of Eureka moments in Python, > moments where you suddenly realise that some task which seemed like it > would be hard work was easy with Python. Mine was definitely when I was first working with the xmlrpc module, and I was pu

Re: Eureka moments in Python

2007-03-13 Thread Brett g Porter
Dustan wrote: > On Mar 13, 10:05 am, Brett g Porter <[EMAIL PROTECTED]> wrote: >> Steven D'Aprano wrote: >>> I'd be interested in hearing people's stories of Eureka moments in Python, >>> moments where you suddenly realise that some task which see

Re: Non-web-based templating system

2006-04-28 Thread Brett g Porter
Diez B. Roggisch wrote: > [EMAIL PROTECTED] wrote: > > Maybe the built-in string interpolation is sufficient? > > print "Hello %(name)s" % dict(name="Peter Pan") Or in recent pythons, the built-in string templating system (see http://docs.python.org/lib/node109.html) >>> from string import

Re: Python program as daemon?

2008-07-25 Thread Brett g Porter
Johny wrote: Is it possible to run a Python program as daemon? Sure -- see http://code.activestate.com/recipes/66012/ for an example (and some useful stuff in the comments.) -- http://mail.python.org/mailman/listinfo/python-list

Re: Reasoning behind 'self' parameter in classes?

2008-07-30 Thread Brett g Porter
Robert Dailey wrote: This is an example of a response I'm looking for: "The self parameter is required because the parser is a bit old and needs to know the exact object you're referencing" This is _not_ an example of what I'm looking for: "Specifying self is a great mysterious thing that we

Re: Python MIDI in 2008

2008-05-06 Thread Brett g Porter
Maciej Bliziński wrote: For the last couple of days, I've been looking for a Python midi library. I'm generally interested in sending MIDI events via ALSA. It seems like everything out there is pretty old; packages are from 2003 or 2005. Some packages don't seem to be really used, for instance po

<    1   2