Re: Determining if file is valid image file

2007-08-02 Thread Dave Hughes
André wrote: > Other than installing PIL, is there a "simple" way using Python only > to determine if a file is a valid image file? > > I'd be happy if I could at least identify valid images files for gif, > jpeg and png. Pointers to existing modules or examples would be > appreciated. > > The

Re: Python's regular expression?

2006-05-10 Thread Dave Hughes
Dave Hansen wrote: > On Wed, 10 May 2006 06:44:27 GMT in comp.lang.python, Edward Elliott > <[EMAIL PROTECTED]> wrote: > > > > > > Would I recommend perl for readable, maintainable code? No, not > > when better options like Python are available. But it can be done > > with some effort. > > I

Re: using ftplib

2006-05-02 Thread Dave Hughes
Steve Holden wrote: > John Salerno wrote: > [...] > > > > So if I already have files on the server and I want to change file > > permissions, do I need to mess with TYPE A/TYPE I commands, or are > > those strictly for when you transfer files? Because I just did a > > quick test of changing fil

Re: using ftplib

2006-05-01 Thread Dave Hughes
John Salerno wrote: > I'm experimenting with this now and I'm a little confused about > transferring commands. This might be more of an FTP question than > strictly Python, but it's still related to how to use the ftplib > methods. > > Anyway, if what I want to do is send a command to change the

Re: regd efficient methods to manipulate *large* files

2006-05-01 Thread Dave Hughes
Madhusudhanan Chandrasekaran wrote: > Hi: > > This question is not directed "entirely" at python only. But since > I want to know how to do it in python, I am posting here. > > > I am constructing a huge matrix (m x n), whose columns n are stored in > smaller files. Once I read m such fil

Re: returning none when it should be returning a list?

2006-05-01 Thread Dave Hughes
Edward Elliott wrote: > [EMAIL PROTECTED] wrote: > > The function basically takes in a list of all the prime number > > found, it takes the next number to be tested for (next) and the > > limit it will go up to. It divide next by the list of previous > > prime numbers if next is not bigger than li

Re: Undocumented alternate form for %#f ?

2006-04-28 Thread Dave Hughes
Dino Viehland wrote: > I'm assuming this is by-design, but it doesn't appear to be > documented: > > >>> '%8.f' % (-1) > ' -1' > >>> '%#8.f' % (-1) > ' -1.' > > > The docs list the alternate forms, but there isn't one listed for > f/F. It would seem the alternate form for floating po

Re: time conversions [hh:mm:ss.ms <-> sec(.ms)

2006-04-28 Thread Dave Hughes
kpp9c wrote: > Hi, > > I was looking at python & datetime and hoping that it would already > have > a method/func to translate time formats. I need to translate seconds > to hh:mm:ss.ms and vice versa and would like the ability to do some > basic arithmetic in these formats. I think that there ju

Re: Strange constructor behaviour (or not?)

2006-04-28 Thread Dave Hughes
Rolf Wester wrote: > Hi, > > when defining: > > class A: > def __init__(self, l=[]): > self.l = l > a = A() > a.l.append() > b = A() > print a.l > > I get the output > > [] > > instead of an empty list. I guess it's because the default value in > the constructor is

Re: Counting elements in a list wildcard

2006-04-24 Thread Dave Hughes
hawkesed wrote: > If I have a list, say of names. And I want to count all the people > named, say, Susie, but I don't care exactly how they spell it (ie, > Susy, Susi, Susie all work.) how would I do this? Set up a regular > expression inside the count? Is there a wildcard variable I can use? > He

Re: Coming from delphi - looking for an IDE - willing to spend money

2006-04-24 Thread Dave Hughes
Just call me James wrote: > Hi, > > Coming away from the luxury of the delphi IDE has been something of a > shock. > > As a consequence I've become aware that maybe I need to spend some > money on a python IDE. > > As a beginner I reckon integrated debugging would be helpful. > > Does anyone h

Re: Problem involving sets...

2006-04-15 Thread Dave Hughes
Kent Johnson wrote: > flamesrock wrote: > > Kind of a fun but confusing problem... > > > > I have two lists. Each list contains elements of two-element lists. > > l1 = [['c1',1],['c2',2],['c3',4]] > > l2 = [['c1',1],['c2',2],['c4',4],['c3',3]] > > > > Exactly in this format, where > > superlist[