snip
os.walk() is a generator. When you iterate over it, like in a for loop,
as
for r,ds,fs in os.walk(...):
r, ds and fs are set to new values at the beginning of each iteration.
If you want to end up with a list of files or dirs, rather than
processing them in the bodies of the file and dir for
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
A side question - why is their a EVT_LIST_BEGIN_DRAG but no
EVT_LIST_END_DRAG, unlike tree's which have BEGIN and END? I
need a draggable list box, and would prefer to not handle low
level mouse events.
My intuition(so
import math
def distance1(x1, y1, x2, y2):
dx = x2 - x1
dy = y2 - y1
dsquared = dx**2 + dy**2
result = math.sqrt(dsquared)
print result
return result
def distance2(x1, y1, x2, y2):
dx = x2 - x1
dy = y2 - y1
dsquared = dx**2 + dy**2
result =
Not in python.
For example, what would you call the following?
def rsum(n, m):
print n+m
return n+m
In python a method is callable attached to an object. A function is a
callable object constructed with a def statement.
max
--
http://mail.python.org/mailman/listinfo/python-list
j is a built-in object used to make complex numbers. Or at least it
was, until you rebound it to the current element from myarray. That's bad
practice, but since using complex numbers is rather unusual, one you will
probably get away with.
Is it?
j
Traceback (most recent call last):
File
rodmc [EMAIL PROTECTED] wrote in news:1136299565.613252.202670
@g44g2000cwa.googlegroups.com:
import _gaim
import wx
from wxPython.wx import *
ID_ABOUT = 101
ID_EXIT = 102
class MyFrame(wxFrame):
def __init__(self, parent, ID, title):
I don't have an answer to your question,
the hard way(in that you have to do it yourself):
def prntime(ms):
s=ms/1000
m,s=divmod(s,60)
h,m=divmod(m,60)
d,h=divmod(h,24)
return d,h,m,s
print '%d days %d hours %d minutes %d seconds' % prntime(100)
0 days 0 hours 16 minutes 40 seconds
print
ProvoWallis [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Hi,
I'm learning more and more about Python all the time but I'm still a
real newbie. I wrote this little script to convert CSV to XML and I
was
hoping to get some feedback on it if anyone was willing to comment.
It works
The encoding argument to unicode() is used to specify the encoding of the
string that you want to translate into unicode. The interpreter stores
unicode as unicode, it isn't encoded...
unicode('\xbe','cp1252')
u'\xbe'
unicode('\xbe','cp1252').encode('utf-8')
'\xc2\xbe'
max
--
Luis P. Mendes [EMAIL PROTECTED] wrote in
suppose I'm reading a csv file and want to create a tuple of all
those rows and values, like ((row1value1, row1value2,
row1value3),(row2value1, row2value2, row2value3),...,
(rowNvalue1, rowNvalue2, rowNvalue3))
I haven't found the way to do it just
james at hal-pc.org wrote in
news:[EMAIL PROTECTED]:
james at hal-pc.org wrote:
the entire 26 character string from site A, but [1] how do i
crop it to 10 characters.
[1] still at a loss on this one, but i can get to it later,
unless you've got any ideas.
strings are slicable:
s='a
james at hal-pc.org wrote in
news:[EMAIL PROTECTED]:
Max Erickson wrote:
the entire 26 character string from site A, but [1] how do i
crop it to 10 characters.
strings are slicable:
The only reason i've gotten this far is a basic understanding of
syntax and programming in general
Nick Vargish [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
I've been trying to figure out how to do something that seems
relatively simple, but it's just not coming together for me. I'm
hoping someone will deign to give me a little insight here.
The problem: We have XML documents that
Nico Grubert [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Hi there,
I would like to open an existing file that contains some lines of
text in order to append a new line at the end of the content.
My first try was:
f = open('/tmp/myfile', 'w') #create new file for writing
Scott David Daniels [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
max wrote:
Larry Bates [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Python has built in eval function and doesn't require a library.
Are you kidding? Read the original post a little more closely.
The o.p. is
Ray [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
image = Image.Image()
Anybody has any idea why this is the case?
Image.Image() isn't the way to get a new image object in PIL. Try
Image.new(), which needs at least mode and size arguments. You can get
those from your original
You need to pass a mask in when you paste in the watermark.
see the documentation for the paste method at
http://effbot.org/imagingbook/image.htm
for more information
This should at least get you started...
import Image
import ImageDraw
import ImageFont
import ImageEnhance
Krisz [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
A.book.Worksheets(1).Range(a1).Characters(1,1)
Traceback (most recent call last):
File interactive input, line 1, in ?
AttributeError: Characters instance has no __call__ method
So my question is that am I doing something wrong or
Tompa [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Hi,
I would like to create images on the fly as a response to an http
request. I can do this with PIL like this (file create_gif.py):
from PIL import Image, ImageDraw
check out sparklines:
Alex [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
D={'Python': 'good', 'Basic': 'simple'}
E=D.copy()
E
{'Python': 'good', 'Basic': 'simple'}
D['Basic']='oh my'
D
{'Python': 'good', 'Basic': 'oh my'}
E
{'Python': 'good', 'Basic': 'simple'}
Hmm, this looks like a deep copy to
David Pratt [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Hi. I am wanting to create a tree list result structure from a
dictionary to categorize results. The dictionary contains elements
that identify its parent. The levels of categorization is not fixed,
so there is a need for the
3c273 [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Hello,
I'm just curious as to why the default rounding in the decimal module
is ROUND_HALF_EVEN instead of ROUND_HALF_UP. All of the decimal
arithmetic I do is rounded half up and I can't think of why one might
use round half even. I
Steve Holden [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Grant Edwards wrote:
On 2006-01-16, Tim Peters [EMAIL PROTECTED] wrote:
http://www.inference.phy.cam.ac.uk/mackay/itila/Potter.html
[Grant Edwards]
That made me smile on a Monday morning (not an insignificant
Sparklines is a script that does exactly what you are asking using python
and PIL:
http://bitworking.org/projects/sparklines/
max
--
http://mail.python.org/mailman/listinfo/python-list
Durumdara [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]:
Can anybody known about DBASE handler module for Python ?
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362715
max
--
http://mail.python.org/mailman/listinfo/python-list
Given that python code is often described in terms of being 'pythonic' or
not, and that pythonic is a term that is apparently well agreed upon yet
seemingly impossible to define for someone who does not already understand
the word, python is probably a zen language.
max
--
you might also want to take a look at
http://unxutils.sourceforge.net/
where are the tools are available in a single zip file.
max
--
http://mail.python.org/mailman/listinfo/python-list
Darren Dale wrote:
def myfunction(filename):
execfile(filename)
print testvar
What am I doing wrong?
I'm not familiar enough with execfile or the interactive interpreter to
know what you are doing wrong, but something like:
def myfunction(filename):
ns=dict()
Marek Franke wrote:
Hi there,
we have started with some people from our LUG (Linux User Group) a
'little'
project, called LMMS (Linux Multimedia System). When it's 'finished'
it
shall be a window-manager for use on TV and handle with
joysticks/gamepads.
As the name says, it is for
I don't quite understand what your program is doing. The user=a[18::20]
looks really fragile/specific to a directory to me. Try something like
this:
a=os.popen(dir /s /q /-c /a-d + root).read().splitlines()
Should give you the dir output split into lines, for every file below
root(notice that
thebjorn [EMAIL PROTECTED] wrote:
Visual Studio 2003 was not found on this system. If you have
Cygwin
installed,
you can try compiling with MingW32, by passing -c mingw32 to
setup.py.
-- bjorn
You need to convince MingW to use the correct VS runtime. Cribbing
from:
aiwarrior [EMAIL PROTECTED] wrote:
Hi i'm having a IO error saying a file does not exist even though
i perform a isFile() check. Can you help me out figuring what is
wrong?
Thanks in advance
from mutagen.easyid3 import EasyID3
from mutagen.mp3 import MP3
for root, dirs, files in
AK [EMAIL PROTECTED] wrote:
Python-by-Example is a guide to LibRef, aiming to give examples
for all functions, classes, modules, etc. Right now examples
for functions in some of the most important modules are
included.
http://pbe.lightbird.net/
thanks,
The second set of examples on
On Apr 13, 2:11 pm, Michel Bouwmans [EMAIL PROTECTED] wrote:
Using this nice class (adapted to urllib2) as a basehandler I see that no
Authentication-header is being send
out:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440574
What am I doing wrong here? I spend almost my entire
Ixiaus [EMAIL PROTECTED] wrote:
I was curious (and have spent an enormous amount of time on Google
trying to answer it for myself) if Python has anything remotely
similar to PHP's SPL __autoload() for loading classes on the fly??
After digging through docs I feel doubtful there is such a
Nick Craig-Wood [EMAIL PROTECTED] wrote:
Joseph [EMAIL PROTECTED] wrote:
All: I have written a program to query Amazon with ISBN and get
the book details. I would like to extend so that I can read
ISBN from the barcode (I will take a photo of the same using
webcam or mobile). Are there
WolfgangZ [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] schrieb:
hi All,
http://mail.python.org/mailman/listinfo/python-list
At least I'm living in a free country and nobody forces me to
learn python. So I don't fully understand why you HAVE TO learn
it. When your problems can be solved in a
Arnaud Delobelle [EMAIL PROTECTED] wrote:
On May 12, 1:30 pm, John Machin [EMAIL PROTECTED] wrote:
Duncan Booth wrote:
[...]
I think the variant I came up with is a bit clearer:
for i in range(1,101):
print '%s%s' % ('' if i%3 else 'Fizz', '' if i%5 else
'Buzz') or
i
More than
castironpi [EMAIL PROTECTED] wrote:
Why can't I write this?
--
http://mail.python.org/mailman/listinfo/python-list
Because you don't know how?
max
--
http://mail.python.org/mailman/listinfo/python-list
Justin Pearson justin.pear...@gmail.com wrote:
Hi all,
I'm looking for a geometry package in Python; something that will
let me define line segments, and can tell me if two line segments
intersect. It would be nice if the lines could be defined in
n-space (rather than be confined to 2 or 3
Bill bsag...@gmail.com wrote:
The delicious api requires http authorization (actually https). A
generic delicious api post url is https://
username:passw...@api.api.del.icio.us/v1/posts/add?url=http://
example.com/description=interestingtags=whatever.
The simplest way is probably to
Mathieu Prevot [EMAIL PROTECTED] wrote:
2008/5/28 Diez B. Roggisch [EMAIL PROTECTED]:
Ankit wrote:
Hi everyone,i wanted to build a flash decoder using python can
somebody tell me which library to use and what steps should i
follow to make a flash(video) decoder?By a decoder i mean that
i
Doug Farrell [EMAIL PROTECTED] wrote:
Hi all,
Does anyone know how to extract images from a PDF file? What I'm
looking to do is use pdflib_py to open large PDF files on our
Linux servers, then use PIL to verify image data. I want to do
this in order to find corrupt images in the PDF files.
Dotan Cohen [EMAIL PROTECTED] wrote:
Maybe you mean:
for match in re.finditer(r'\([A-Z].+[a-z])\', contents):
Note the last backslash was in the wrong place.
The location of the backslash in the orignal reply is correct, it is
there to escape the closing paren, which is a special character:
Andy Cheesman [EMAIL PROTECTED] wrote:
Check out kodos http://kodos.sourceforge.net/ for an interactive
python regexp tester
Andy
On systems with tkinter installed(So pretty much all Windows and lots
and lots of Linux systems), the redemo.py script in the Tools/Scripts
directory of the
Dirk Hagemann [EMAIL PROTECTED] wrote:
Dirk
Additional to my last posting: if you want to try this out in
Excel you should replace the command REST by the english
command what should be something like remainder.
The equivalent in my (U.S. English, 2000) version of excel is called
'MOD'.
[EMAIL PROTECTED] wrote:
I would highly appreciate if someone could help me with how to
proceed (step-by-step) to get started and use the eyeD3 library
in Windows?
Many thanks in advance!
It appears that you need to do as follows:
Extract the tar.gz to a temporary directory.
rename
Mick Duprez [EMAIL PROTECTED] wrote:
Hi All,
I've installed Python 2.5 on a number of machines but on one I'm
having problems with the CLI.
If I fire up the 'cmd' dos box and type 'python' I get a line of
gibberish and it locks up the cli, if I run the 'command' dos box
I get a few lines
per9000 [EMAIL PROTECTED] wrote:
# w is for writing
myfile = open('theoutfile',w)
That won't work, the second argument to open needs to be a string:
myfile = open('theoutfile', 'w')
max
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh [EMAIL PROTECTED] wrote:
Max Erickson wrote:
# w is for writing
myfile = open('theoutfile',w)
That won't work, the second argument to open needs to be a string:
w = 'w'
/F
Is it inappropriate to call the w on the left side of the equal's sign
a string? I.e., w
mateus [EMAIL PROTECTED] wrote:
print hello world
I have a nested loop where the outer loop iterates over key value
pairs of a dictionary and the inner loop iterates over a list
each list of which is a mapped value from the dictionary
def showReport(self):
for dev, sessions
David Isaac [EMAIL PROTECTED] wrote:
1. Why is there no argmax built-in?
(This would return the index of the largest element in a
sequence.)
2. Is this a good argmax (as long as I know the iterable is
finite)? def argmax(iterable): return max(izip( iterable, count()
))[1]
use len:
I'm no expert, but your post made me curious. It appears that __all__
has the effect of ensuring that
from test import *
picks up test1, but doesn't go any further than that.
from test.test1.test2 import *
should cause test3 to be imported.
max
--
Roberto Bonvallet [EMAIL PROTECTED] wrote:
You don't need map when using list comprehensions:
[ for i in [a, b, c] if i in (None, None)]
That loses list elements that aren't in the tests:
a=7
b=None
c=None
[ for i in [a,b,c] if i in (None,None)]
['', '']
max
--
bussiere maillist [EMAIL PROTECTED] wrote:
--=_Part_118629_1441854.1150895040355
i truly didn't understand this error :
Traceback (most recent call last):
File D:\Programmation\FrancePaquet\FrancePaquet.py, line 77,
in ?
cabtri = zz + chiffrescabtri + clefc
TypeError: coercing
Anton Vredegoor [EMAIL PROTECTED] wrote:
However, I knew of the existence of such languages but I am
mostly interested in standardized code interchange, like for
example with JSONP which fetches some external javascriptcode
from another server using JSON and places the translated
Mark [EMAIL PROTECTED] wrote:
...
#!/usr/bin/env python
from myprog import main
if __name__ == __main__:
main()
Of course this compiles myprog.py into myprog.pyc on first run as
I am wanting.
I have one of these stubs for all my python scripts I've created
so far. Is there not a
7stud [EMAIL PROTECTED] wrote:
On Mar 24, 8:30 am, Duncan Booth [EMAIL PROTECTED]
wrote:
In case you are feeling that the ','.join(l) looks a bit
jarring, be aware that there are alternative ways to write it.
You can call the method on the class rather than the instance:
jl =
John Nagle [EMAIL PROTECTED] wrote:
htags = soup.findAll({'h2':True, 'H2' : True}) # get all H2 tags,
both cases
Have you been bitten by this? When I read this, I was operating under
the assumption that BeautifulSoup wasn't case sensitive, and then I
tried this:
import BeautifulSoup as BS
Subscriber123 [EMAIL PROTECTED] wrote:
urllib, or urllib2 for advanced users. For example, you can
easily set your own headers when retrieving and serving pages,
such as the User-Agent header which you cannot set in either
urllib or urllib2.
Sure you can. See:
Collin Stocks [EMAIL PROTECTED] wrote:
--=_Part_19087_21002019.1176329323968
I tried it, and when checking it using a proxy, saw that it
didn't really work, at least in the version that I have (urllib
v1.17 and urllib2 v2.5). It just added that header onto the end,
therefore making there
Antoon Pardon [EMAIL PROTECTED] wrote:
On 2007-04-20, Max Erickson [EMAIL PROTECTED] wrote:
If we are being pedantic about describing a curve that shows the
progress of a person in learning a topic, there is no arguing
with you, a steep curve describes fast uptake and is a good
thing
Antoon Pardon [EMAIL PROTECTED] wrote:
Just asserting how something can make a difference withouth
arguing how in the particular case it actucally makes a
difference is just a divertion tactic without real merrit.
In the face of a notion that all steep curves determining
progress made in
Ben Edwards (lists) [EMAIL PROTECTED] wrote:
I am using python 2.4 on Ubuntu dapper, I am working through Dive
into Python.
...
Any insight?
Ben
Did you follow all the instructions, or did you try to call
sys.setdefaultencoding interactively?
See:
Keith [EMAIL PROTECTED] wrote:
Any help would be great.
Cheers,
Keith
Do you absolutely need the functionality to be in the __init__ method,
or does something like the following work:
IDs={}
class ID: pass
def factory(ident):
if ident in IDs:
[EMAIL PROTECTED] wrote:
Brendon A shortcut occurs to me; maybe someone can tell me
what's wrong Brendon with my reasoning here. It seems that
any string that is unsafe Brendon to pass to eval() must
involve a function call, and thus must Brendon contain an
opening
Gabriel Genellina [EMAIL PROTECTED] wrote:
...
This recent blog post contains step-by-step instructions on using
free tools to compile python extensions:
http://boodebr.org/main/python/build-windows-extensions
--
...
The package available here:
http://www.develer.com/oss/GccWinBinaries
Lad [EMAIL PROTECTED] wrote:
from
image:
http://www.pythonware.com/library/pil/handbook/image.htm
This is some example code:
from PIL import Image
im = Image.open(1.jpg)
nx, ny = im.size
im2 = im.resize((int(nx*1.5), int(ny*1.5)), Image.BICUBIC)
im2.save(2.png)
Bye,
bearophile,
James [EMAIL PROTECTED] wrote:
--=_Part_63041_761240.1159752399799
I'm writing a script in linux to excercise my python skills and
have encountered a minor issue.
Writing the script and creating an ouput file was simple enough
and didn't take too long. However, I don't have permissions
Karlo Lozovina [EMAIL PROTECTED] wrote:
I'm looking for a Python lib which can read and _write_ ID3v1 and
ID3v2 tags, and as well read as much as possible data from MP3
file (size, bitrate, samplerate, etc...).
MP3 reproduction is of no importance...
Try mutagen:
Teja [EMAIL PROTECTED] wrote:
Hi all,
What is attribute error? what causes that error, especially with COM
objects?
To be precise :
Attribute Error: LCAS.LabcarController.writeLogWindow()
Here, LCAS is a COM object
Thanks
Teja.P
LabcarController might be a function. See:
spawn [EMAIL PROTECTED] wrote:
but I've been struggling with this for far too long and I'm about
to start beating my head against the wall.
--
I tried adding an additional while statement to capture the
second number, but it didn't seem to solve my problem. Help!
Chris [EMAIL PROTECTED] wrote:
from math import *
sin(0)
0.0
sin(pi)
1.2246063538223773e-016
sin(2*pi)
-2.4492127076447545e-016
cos(0)
1.0
cos(pi)
-1.0
cos(2*pi)
1.0
The cosine function works fine, but I'm getting weird answers for
sine. Is this a bug? Am I doing something wrong?
Max Erickson [EMAIL PROTECTED] wrote:
Try sin(pi*0.5) to see similar behavior to cos(pi) or cos(pi*2).
Uhh, switch that, cos(pi*0.5)...
--
http://mail.python.org/mailman/listinfo/python-list
MatthewWarren [EMAIL PROTECTED] wrote:
Thanks, is that a newsgroup I can view through google groups? I
tried seraching for it but google says no..
And I'll give that list a subscribe.
I have found a wxPython google group, but only 11 members and a
handfull of posts in a year...
Brian Blais [EMAIL PROTECTED] wrote:
Hello,
I want to set up a system where I can have my family members
write comments about a number of pictures, as part of a family
tree project. Essentially, I want them to be able to log into a
website (I already have the webspace, and the server runs
Gerardo Herzig [EMAIL PROTECTED] wrote:
Hi all: I have this list thing as a result of a db.query: (short
version) result = [{'service_id' : 1, 'value': 10},
{'service_id': 2, 'value': 5},
{'service_id': 1, 'value': 15},
{'service_id': 2,
Steve Holden [EMAIL PROTECTED] wrote:
Gabriel Genellina wrote:
At Wednesday 25/10/2006 22:29, Terry Reedy wrote:
the string class's nil value. Each of the builtin types
has such an empty or nil value:
string
list[]
tuple ()
Johanna Pfalz [EMAIL PROTECTED] wrote:
Is there a module/method in python to convert a file from .DBF
format to .CSV format?
Johanna Pfalz
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362715
There is an example provided.
max
--
kath [EMAIL PROTECTED] wrote:
hi, Larry Bates thanks for the reply...
You might consider doing it the same way wx passes things around.
When you instantiate the subclass pass the parent class' instance
as first argument to __init__ method.
Yes thats absolutely right..
That way
Gregory Piñero [EMAIL PROTECTED] wrote:
On 11/8/06, Gregory Piñero [EMAIL PROTECTED] wrote:
I want to be able to randomly change pixels in an image and view
the results. I can use whatever format of image makes this
easiest, e.g., gray scale, bit tonal, etc.
Ideally I'd like to keep the
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Hi,
I'm a big fan of path.py. One thing that I think is a good idea
is for directories to automatically have a slash appended to them
if it is not automatically added. Eg:
from path import path
dir = path('/some/dir')
x = dir + file #
color='orange'
if color=='red' or 'blue' or 'green':
print Works?
Works?
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
But this gives me IndexError: list out of range
You are making the list shorter as you are iterating. By the time your
index is at the end of the original list, it isn't that long any more.
Creating a new list and appending the elements you
[EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
I went to this webpage
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/360649
Isn't it supposed to run on the network and close the connected
machine.
That code uses the windows libraries on the machine it is run on to
generate
Andrew Robert [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Hi Everyone.
I tried the following to get input into optionparser from either
a file or command line.
The code below detects the passed file argument and prints the
file contents but the individual swithces do not get
Andrew Robert [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Any ideas?
I don't know much about optparse, but since I was bored:
help(o.parse_args)
Help on method parse_args in module optparse:
parse_args(self, args=None, values=None) method of
optparse.OptionParser instance
Dustan [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
The task manager says CPU Usage: 100% when the program is
running, and only when the program is running.
Efficiency is a measure of 2 things: CPU usage and time. If you
measure just time, you're not necessarily getting the
Bruno Desthuilliers wrote
It has been, at a time, recommended to use file() instead of
open(). Don't worry, open() is ok - and I guess almost anyone
uses it.
http://mail.python.org/pipermail/python-dev/2005-December/059073.html
--
http://mail.python.org/mailman/listinfo/python-list
One way:
class Boo:
def __init__(self, parent):
self.parent=parent
class Foo:
X=1
def __init__(self):
self.test=boo(self)
--
http://mail.python.org/mailman/listinfo/python-list
Andrew Robert [EMAIL PROTECTED] wrote:
ValueError: invalid literal for int(): %
Does anyone see what I am doing wrong?
Try getting rid of the lamba, it might make things clearer and it
simplifies debugging. Something like(this is just a sketch):
def callback(match):
print
Andrew Robert [EMAIL PROTECTED] wrote:
import re,base64
# Evaluate captured character as hex
def ret_hex(value):
return base64.b16encode(value)
def ret_ascii(value):
return base64.b16decode(value)
Note that you can just do this:
from base64 import b16encode,b16decode
and
cesco [EMAIL PROTECTED] wrote:
Hi,
I have a dictionary of lists of tuples like in the following
example: dict = {1: [(3, 4), (5, 8)],
2: [(5, 4), (21, 3), (19, 2)],
3: [(16, 1), (0, 2), (1, 2), (3, 4)]]
In this case I have three lists inside the dict but this number
is
Gabriel Genellina [EMAIL PROTECTED] wrote:
At Wednesday 10/1/2007 14:38, [EMAIL PROTECTED] wrote:
d =
feedparser.parse('http://weather.yahooapis.com/forecastrss?p=
94089')
d.feed.yweather_location
u''
You have to feed it the *contents* of the page, not its URL.
The online
m.banaouas [EMAIL PROTECTED] wrote:
Hi all,
I started to use urllib2 library and HTTPBasicAuthHandler class
in order to authenticate with a http server (Zope in this case).
I don't know why but it doesn't work, while authenticating with
direct headers manipulation works fine!
...
m.banaouas [EMAIL PROTECTED] wrote:
...
passman.add_password(None, auth_url, data['user'] ,
...
The only thing I can come up with is that auth_url can't begin with a
protocol, like http:// or whatever.
max
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
Was anybody blogging about PyCon (talks and/or sprints)? Got any
pointers?
Thanks,
Skip
In no particular order:
http://www.nedbatchelder.com/blog/20070226T075948.html
http://www.oreillynet.com/onlamp/blog/2007/02/pycon_day_1_1.html
Roger [EMAIL PROTECTED] wrote:
Does anybody have a pointer to a Python library/utility that will
extract the chrominance and luminance quantization tables from
JPG images?
I have been using the _getexif method from PIL, which works fine,
but doesn't extract the quantization data. I am a
cyberco [EMAIL PROTECTED] wrote:
I'm using web.py to send an image to the client. This works
(shortened):
print open(path, rb).read()
but this doesn't:
img = Image.open(path)
img.thumbnail((10,10))
print img.getdata()
or
print img.load()
How do I get the bytes of the Image
cyberco [EMAIL PROTECTED] wrote:
Thanks,
I've tried the StringIO option as follows:
=
img = Image.open('/some/path/img.jpg')
img.thumbnail((640,480))
file = StringIO, StringIO()
Is the above line exactly what you tried? If it is, the comma and
space in
1 - 100 of 108 matches
Mail list logo