Re: [Tutor] glob in order of the file numbers

2009-03-06 Thread Kent Johnson
On Fri, Mar 6, 2009 at 9:52 PM, Emad Nawfal (عماد نوفل) wrote: > Hi Tutors, > suppose I have four files in the current directory: 1.temp, 2.temp, 3.temp, > and 4.temp. I want to use glob, or anything else, to print the contents of > the files in their respective orders, where the content of 1.temp

Re: [Tutor] image processing

2009-03-06 Thread Kent Johnson
On Fri, Mar 6, 2009 at 7:05 PM, Harris, Sarah L wrote: > Could someone please let me know where I can find 'lots' of examples of > image processing using python? Particularly MODIS and ASTER examples. > Any feedback will be greatly appreciated. There is one complete example here: http://pyevolve.

Re: [Tutor] glob in order of the file numbers

2009-03-06 Thread Senthil Kumaran
2009/3/7 Emad Nawfal (عماد نوفل) : > import glob > for path in glob.iglob("*.temp"): >     infile = open(path) >     for line in infile: >         print line.strip() import glob files = sorted(glob.glob("*.temp")) for each in files: print open(each).read() Note couple of things: - glob.glob

Re: [Tutor] glob in order of the file numbers

2009-03-06 Thread Bill Campbell
On Fri, Mar 06, 2009, Emad Nawfal ( ) wrote: > > Hi Tutors, > suppose I have four files in the current directory: 1.temp, 2.temp, > 3.temp, and 4.temp. I want to use glob, or anything else, to print the > contents of the files in their respective orders, where the content of > 1.t

[Tutor] glob in order of the file numbers

2009-03-06 Thread عماد نوفل
Hi Tutors, suppose I have four files in the current directory: 1.temp, 2.temp, 3.temp, and 4.temp. I want to use glob, or anything else, to print the contents of the files in their respective orders, where the content of 1.temp gets printed, then 2.temp, then 3.temp, then 4.temp. I write the follow

Re: [Tutor] memory error

2009-03-06 Thread Oxymoron
Hello, On Sat, Mar 7, 2009 at 11:03 AM, Harris, Sarah L wrote: > import zipfile, glob, os > os.chdir('E:\\test1') > from os.path import isfile > fname=filter(isfile, glob.glob('*.zip')) > for fname in fname: >     zipnames=filter(isfile, glob.glob('*.zip')) >     for zipname in zipnames: >   

[Tutor] memory error

2009-03-06 Thread Harris, Sarah L
Hello, I am very much a beginner at programming. As a learning tool I am trying to extract multiple zipped files. I got it to work after looking at lots of other examples (see below for code) but because some of my files are quite large I end up with a 'Memory Error'. Is there a simple way to fi

[Tutor] image processing

2009-03-06 Thread Harris, Sarah L
Could someone please let me know where I can find 'lots' of examples of image processing using python? Particularly MODIS and ASTER examples. Any feedback will be greatly appreciated. Regards Sarah ___ Tutor maillist - Tutor@python.org http://mail.pyth

Re: [Tutor] print problem python

2009-03-06 Thread Vern Ceder
In Python 3, you need to put ( ) around what you want to print, so it would be: print("hello world") Cheers, Vern mustafa akkoc wrote: i start learning pyton language i want to print some thing but when i type : print "hello world" but it give an error like this SyntaxError: invalid synt

[Tutor] print problem python

2009-03-06 Thread mustafa akkoc
i start learning pyton language i want to print some thing but when i type : print "hello world" but it give an error like this SyntaxError: invalid syntax (, line 1) i am using python shell version 3.0.1 -- Mustafa Akkoc ___ Tutor maillist - Tutor

Re: [Tutor] Misunderstanding the Entry Widget

2009-03-06 Thread Kent Johnson
On Fri, Mar 6, 2009 at 11:26 AM, Wayne Watson wrote: > I've just got to stop using one letter for variables, especially ones that > sound alike! :-) > > Other than v tracking every value change made, did I gain anything by using > it? It seems to me that control variables are of marginal use. I mi

Re: [Tutor] does id function return location of reference or the referenced object?

2009-03-06 Thread Kent Johnson
On Fri, Mar 6, 2009 at 12:09 PM, Serdar Tumgoren wrote: > So can I ask what happens internally in python when you create open a file > object in a loop without assigning that file object to a variable? > > E.g.: > > for line in open(file.py): >    print line > > In the above, is pythonimplicitly c

Re: [Tutor] does id function return location of reference or the referenced object?

2009-03-06 Thread Serdar Tumgoren
So can I ask what happens internally in python when you create open a file object in a loop without assigning that file object to a variable? E.g.: for line in open(file.py): print line In the above, is pythonimplicitly creating a reference to a file object and using that in the for loop? Or

Re: [Tutor] does id function return location of reference or the referenced object?

2009-03-06 Thread Kent Johnson
On Fri, Mar 6, 2009 at 11:08 AM, Serdar Tumgoren wrote: > Hi all, > > I've managed to think myself in circles and was hoping someone could help > clarify the nature of the "id" function and references in general. > > I initially got confused while dealing with file objects, so I'll stick with > th

Re: [Tutor] Misunderstanding the Entry Widget

2009-03-06 Thread Wayne Watson
I've just got to stop using one letter for variables, especially ones that sound alike! :-) Other than v tracking every value change made, did I gain anything by using it? It seems to me that control variables are of marginal use. I might have thought they were necessary for use with scale wid

[Tutor] does id function return location of reference or the referenced object?

2009-03-06 Thread Serdar Tumgoren
Hi all, I've managed to think myself in circles and was hoping someone could help clarify the nature of the "id" function and references in general. I initially got confused while dealing with file objects, so I'll stick with that example. My question, based on the below tests in the ipython int

Re: [Tutor] using re groups

2009-03-06 Thread Kent Johnson
On Fri, Mar 6, 2009 at 7:56 AM, ski wrote: > Hello, > I have this: > import re s = "Association of British Travel Agents (ABTA) No. 56542\nAir Travel Organisation Licence (ATOL)\nAppointed Agents of IATA (IATA)\nIncentive Travel & Meet. Association (ITMA)" licenses = re.sp

[Tutor] using re groups

2009-03-06 Thread ski
Hello, I have this: >>> import re >>> s = "Association of British Travel Agents (ABTA) No. 56542\nAir Travel Organisation Licence (ATOL)\nAppointed Agents of IATA (IATA)\nIncentive Travel & Meet. Association (ITMA)" >>> licenses = re.split("\n+", s) >>> licenseRe = re.compile(r'\(([A-Z]+)\)( N

Re: [Tutor] Misunderstanding the Entry Widget

2009-03-06 Thread Kent Johnson
On Fri, Mar 6, 2009 at 7:15 AM, Wayne Watson wrote: > Control variables. What is the difference between IntVar,  BooleanVar, > StringVar,  and DoubleVar? The difference is the type of value returned by get(). > For example, in the program below, it looks like > I get the same result usint IntVa

Re: [Tutor] Misunderstanding the Entry Widget

2009-03-06 Thread Wayne Watson
Title: Signature.html Control variables. What is the difference between IntVar,  BooleanVar,  StringVar,  and DoubleVar?  For example, in the program below, it looks like I get the same result usint IntVar or StringVar. It almost appears the usage depends on what widget one uses: Entry, RadioBu

Re: [Tutor] Misunderstanding the Entry Widget

2009-03-06 Thread Kent Johnson
On Thu, Mar 5, 2009 at 10:52 PM, Wayne Watson wrote: > Apparently Entry does not have a callback. It seems as though it should. If > one enters data into it and presses Return, then it would be good to know > what the data is, so it can be used elsewhere. However, that's not the way > it works. On

Re: [Tutor] array and ndarray

2009-03-06 Thread Kent Johnson
On Thu, Mar 5, 2009 at 8:38 PM, Mr Gerard Kelly wrote: > I am trying to convert something using the old Numeric module to the numpy > module. > > This is the code so far:: > > from __future__ import division > > import pygame, time, random, pygame.sndarray > sample_rate = 44100 > > from numpy imp

Re: [Tutor] Misunderstanding the Entry Widget

2009-03-06 Thread Alan Gauld
"Wayne Watson" wrote Apparently Entry does not have a callback. Thats the magic of Control Variables. They automatically get populated when the user enters data into the Entry widget. But since Entry widgets are usually part if a form and there will be several of them its more useful to