Suppose I have several variables, e.g.: a, b, c, d, e, f, g.
I would like to be able to see if they're all the same, I don't care what
the value is, as long as they're equal. If they're all equal to 0, or to
"spam", or to ["cleese", "idle", "gilliam"], as long as they're the same.
Is there a mo
Thanks Alan, that clears things up quite well.
Bernard
On 5/14/05, Alan Gauld <[EMAIL PROTECTED]> wrote:
> > So if I undestand you right, mapping a function with map()
> > when it is a built-in function will/may be faster than a for
> > loop, but if it's a custom function (ie. a def one), it wil
>The idea is to print out a multiplication table on the command line
>with numbers lining up in the ones column. I want to eventually
>emulate programs like top with their spacing. But this code is mostly
>for my amusement. How would you make this work?
>
Try print string formatting using %
>>>p
On May 14, 2005, at 20:09, Aaron Elbaz wrote:
> The idea is to print out a multiplication table on the command line
> with numbers lining up in the ones column. I want to eventually
> emulate programs like top with their spacing. But this code is mostly
> for my amusement. How would you make this
I've been racking my brain and am right now feeling nauseous from not
being able to figure out such a simple problem. Here's the code:
#r=10
#line=1
#
#def spaces(r):
#return r/10
#
#while line-1 < r:
#for i in range(r):
#print str((i+1)*line) + ' '*spaces(r),
#line=line+1
#
On 14 Mai 2005, [EMAIL PROTECTED] wrote:
> Here's the problem - I want a list (array) of the files in a directory,
> and then I want to iterate over the list testing for image-ness (with
> imghdr.what()) and put all the image filenames in a global list.
>
> What I've tried is this:
>
> files = glo
Hi William,
First, check out the os and os.path modules. It has exactly what you
need to handle files and directories.
http://www.python.org/doc/2.4.1/lib/module-os.html
More specifically:
http://www.python.org/doc/2.4.1/lib/os-file-dir.html
http://www.python.org/doc/2.4.1/lib/module-os.path.html
Here's the problem - I want a list (array) of the files in a directory,
and then I want to iterate over the list testing for image-ness (with
imghdr.what()) and put all the image filenames in a global list.
What I've tried is this:
files = glob.glob('*.*')
for file in files:
global pics