Matt Haggard wrote:
> I'm using PIL (Python Imaging Library) to generate button images.
> They consist of a left end image, a middle, repeating image and a
> right side image anyway, that's not important
>
> I'm using a TTF font for the text of the button (Verdana.TTF) and it
> keeps cutting t
[EMAIL PROTECTED] wrote:
> On Apr 26, 8:34 pm, asker <[EMAIL PROTECTED]> wrote:
>> But:>>> print "%15.2f" % a+b
>>
>> Traceback (most recent call last):
>> File "", line 1, in
>> TypeError: cannot concatenate 'str' and 'float' objects
>>
>> Is this correct for Python to issue this error?
>
> Th
Fredrik Lundh wrote:
> Almad wrote:
>
>> However, when constructing dictionary with dictionary in constructor
>> like d = RegisterMap({'k':'v'}), __setitem__ is not called
>
> why should it do that? dict() is a concrete implementation, not a
> template class for the creation of dict-like object
Robert R. wrote:
> Hello,
>
> i would like to write a piece of code to help me to align some sequence
> of words and suggest me the ordered common subwords of them
>
> a trouble i have if when having many different strings my results tend
> to be nothing while i still would like to have one of th
Nick Craig-Wood wrote:
>>> open STDOUT, '>/dev/null';
>> sys.stdout = open(os.devnull, 'w')
> $ ls -l /proc/32004/fd
> total 4
> lrwx-- 1 ncw ncw 64 Nov 28 09:55 0 -> /dev/pts/17
> lrwx-- 1 ncw ncw 64 Nov 28 09:55 1 -> /dev/pts/17
> lrwx-- 1 ncw ncw 64 Nov 28 09:55 2 -> /dev/pts/17
[EMAIL PROTECTED] wrote:
> Is there a module out there that will generate an image with a random text
> string such as the confirmation images you see on various websites?
They're called captcha images or captchas for short.
Googling for "python captcha" returns several hits; see what you like...
I am trying to run a subprocess within given time and memory restrictions.
The resource module kind of works for me, but I do not understand why and am
seeking an
explanation. Also, the signal module is not behaving as I'd expect it to.
Demo code with questions:
==
import subprocess as
zefciu wrote:
> In the tutorial there is an example iterator class that revesrses the
> string given to the constructor. The problem is that this class works
> only once, unlike built-in types like string. How to modify it that it
> could work several times? I have tried two approaches. They bo
[EMAIL PROTECTED] wrote:
> Does anyone know of a way to embed python scripts into html, much like
> you would javascript or php?
Two very different things, JS and PHP... First make sure you know what you're
after.
If you want PHP-like embedding of code, google for "python server pages".
Several
John Salerno wrote:
> [EMAIL PROTECTED] wrote:
>> hi
>>
>> if i have a some lines like this
>> a ) "here is first string"
>> b ) "here is string2"
>> c ) "here is string3"
>>
>> When i specify i only want to print the lines that contains "string" ie
> ...
> And I'm actually ashamed to admit that I
Brian Quinlan wrote:
> The fastest algorithm that I have been able to devise for doing so is:
> O(n * log(len(lst))). Can anyone think or a solution with a better time
> complexity? If not, is there an obviously better way to do this
> (assuming n is big and the list size is small).
If list is
DrConti wrote:
> class ObjectClass:
> """ Test primary Key assignment """
>
> if __name__ == "__main__":
> ObjectClassInstantiated=ObjectClass()
> ObjectClassInstantiated.AnAttribute='First PK Elem'
> ObjectClassInstantiated.AnotherOne='Second PK Elem'
> ObjectClassIn
[EMAIL PROTECTED] wrote:
> On more than one occasion, I found myself wanting to use a "conditional
> loop" like this (with "Invalid syntax" error, of course):
>
> for i in c if :
> print i*2
Maybe there's been a PEP, don't really know...
Currently, the only sensible alternati
Steve R. Hastings wrote:
> I was looking at a Python function to find the maximum from a list.
> The original was more complicated; I simplified it. The built-in max()
> function can replace the simplified example, but not the original.
But you forgot to shuw us the original...
[snip several im
>> i have some regular exp code in perl that i want to convert to python.
>> if $line =~ m#<(tag1)>(.*)#
>>{
>> $variable = $2;
>> }
> regexp = re.compile(r"<(tag1)>(.*)")
> line = "sometext"
> match = regexp.search(line)
> if match:
>variable = match.group(2)
Or, if you pre
swisscheese wrote:
> I figured someone out there must have written a minimal code size prime
> number generator. I did not find one after a bit of searching around.
> For primes up to 100 the best I could do was 70 characters (including
> spaces):
>
> r=range(2,99)
> m=[x*y for x in r for y in r]
[hint: posting the same question in newsgroups generally
does not help to get responses any quicker]
Ernesto wrote:
> The string I'm getting data from looks like this:
> [USELESS DATA]
> Request : Play
> [USELESS DATA]
> Title: Beethoven's 5th
> [USELESS DATA]
> Request : next
> [USELESS
28tommy wrote:
> Hi,
> I'm trying to find scripts in html source of a page retrieved from the
> web.
> I'm trying to use the following rule:
>
> match = re.compile('')
>
> I'm testing it on a page that includes the following source:
>
>