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 the
[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 stdin, line 1, in module
TypeError: cannot concatenate 'str' and 'float' objects
Is this correct for Python to issue this error?
The % operator
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 objects.
I
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 the, or
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
l-wx-- 1
[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
[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
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 both
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 know the RE way, but not
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
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
[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 test:
print i*2
Maybe there's been a PEP, don't really know...
Currently, the only sensible alternative
DrConti wrote:
class ObjectClass:
Test primary Key assignment
if __name__ == __main__:
ObjectClassInstantiated=ObjectClass()
ObjectClassInstantiated.AnAttribute='First PK Elem'
ObjectClassInstantiated.AnotherOne='Second PK Elem'
i have some regular exp code in perl that i want to convert to python.
if $line =~ m#(tag1)(.*)/\1#
{
$variable = $2;
}
regexp = re.compile(r(tag1)(.*)/\1)
line = tag1sometext/tag1
match = regexp.search(line)
if match:
variable = match.group(2)
Or, if you prefer
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]
[x
[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 DATA]
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('script [re.DOTALL]+ src=[re.DOTALL]+')
I'm testing it on a page that includes the following source:
script language=JavaScript1.2
Philippe C. Martin wrote:
Hi,
The following code outputs the actual HTML text to the browser, not the
interpreted text.
Any idea ?
html_ok =
Content-Type: text/html\n
html
...
Avoid the starting newline (before content-type).
Add at least TWO newlines after content-type.
Or
jbrewer wrote:
I'm currently writing my first CGI script (in Python), and I keep
getting an error I don't know how to address. I'm not sure if this is
a Python or Apache error, but I suspect it's an Apache config thing.
I suspect it's neither :)
Make sure your HTML form looks like
form
20 matches
Mail list logo