Re: [Tutor] How to import a few modules when I enter python?

2012-08-07 Thread Peter Otten
Santosh Kumar wrote: Hello there, I have a few scripts that I made to experiment with, I have to import them everytime I enter the Python shell. The scripts are in `/home/username/workshop/` (this directory has also some non .py files) directory. Is there a way I can import them as soon as

Re: [Tutor] How to import a few modules when I enter python?

2012-08-07 Thread Steven D'Aprano
On Tue, Aug 07, 2012 at 09:09:02AM +0530, Santosh Kumar wrote: Hello there, I have a few scripts that I made to experiment with, I have to import them everytime I enter the Python shell. The scripts are in `/home/username/workshop/` (this directory has also some non .py files) directory. Is

[Tutor] Question about reading from a file.

2012-08-07 Thread Brad Dutton
I recently discovered how to read from a file but I've having some trouble with it. I made a short example program that goes like this: 1. fob = open('c:/python27/a.txt', 'r') 2. 3. print fob.read() 4. print fob.read() When it runs it returns this: 1. Hey now brown cow 2.

[Tutor] Built in functions

2012-08-07 Thread Dane Saltzman
I'm new to python and I was wondering if you could tell me how I would: first, define a function,distance_from_zero, with one parameter (choose any parameter name you like). Second, have that function do the following: 1. Check the type of the input it receives. 2. If the type 

Re: [Tutor] *large* python dictionary with persistence storage for quick look-ups

2012-08-07 Thread Albert-Jan Roskam
From: Abhishek Pratap abhishek@gmail.com To: tutor@python.org Sent: Tuesday, August 7, 2012 1:12 AM Subject: [Tutor] *large* python dictionary with persistence storage for quick look-ups Hey Guys I have asked a question on stackoverflow and thought I

Re: [Tutor] Built in functions

2012-08-07 Thread Peter Otten
Dane Saltzman wrote: I'm new to python and I was wondering if you could tell me how I would: first, define a function,distance_from_zero, with one parameter (choose any parameter name you like). Second, have that function do the following: 1. Check the type of the input it receives. 2.

Re: [Tutor] Question about reading from a file.

2012-08-07 Thread Peter Otten
Brad Dutton wrote: I recently discovered how to read from a file but I've having some trouble with it. I made a short example program that goes like this: 1. fob = open('c:/python27/a.txt', 'r') 2. 3. print fob.read() 4. print fob.read() When it runs it returns this:

Re: [Tutor] Question about reading from a file.

2012-08-07 Thread Mark Lawrence
On 04/08/2012 22:51, Brad Dutton wrote: I recently discovered how to read from a file but I've having some trouble with it. I made a short example program that goes like this: 1. fob = open('c:/python27/a.txt', 'r') 2. 3. print fob.read() 4. print fob.read() When it runs it

Re: [Tutor] Question about reading from a file.

2012-08-07 Thread Joel Goldstick
On Tue, Aug 7, 2012 at 5:12 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 04/08/2012 22:51, Brad Dutton wrote: I recently discovered how to read from a file but I've having some trouble with it. I made a short example program that goes like this: 1. fob = open('c:/python27/a.txt',

Re: [Tutor] Built in functions

2012-08-07 Thread Joel Goldstick
On Tue, Aug 7, 2012 at 4:37 AM, Peter Otten __pete...@web.de wrote: Dane Saltzman wrote: I'm new to python and I was wondering if you could tell me how I would: first, define a function,distance_from_zero, with one parameter (choose any parameter name you like). Second, have that function do

Re: [Tutor] Question about reading from a file.

2012-08-07 Thread Ramchandra Apte
Imagine a book. .read(num) reads a page of the book Now if you call again it goes to the next page. Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor

Re: [Tutor] Code Review?

2012-08-07 Thread Tino Dai
On Mon, Aug 6, 2012 at 6:27 PM, Brian Carpio bcar...@thetek.net wrote: Thanks to everyone who has replied! This is some good information for me to go learn with!. I greatly appreciate it. When you refactor your code, let us know. I, for one, would like to see it.

Re: [Tutor] Question about reading from a file.

2012-08-07 Thread Mark Lawrence
On 07/08/2012 13:37, Ramchandra Apte wrote: Imagine a book. .read(num) reads a page of the book Now if you call again it goes to the next page. Please don't top post. This is now the fourth time you've been asked. -- Cheers. Mark Lawrence.

Re: [Tutor] Built in functions

2012-08-07 Thread Mark Lawrence
On 07/08/2012 10:48, Joel Goldstick wrote: On Tue, Aug 7, 2012 at 4:37 AM, Peter Otten __pete...@web.de wrote: Dane Saltzman wrote: I'm new to python and I was wondering if you could tell me how I would: first, define a function,distance_from_zero, with one parameter (choose any parameter

[Tutor] Unzip a zipfile, then unzip the zipfiles within the original zip

2012-08-07 Thread Gregory Lund
# neophyte .py/pyTutor user. # I am also a university GIS lecturer. My students submit their lab assignments (zipped up into one zipfile) to a depository, which I download as a single zip containing all 40 students' zipfiles. # Goal: unzip a zipfile of student zipfiles and then unzip each

Re: [Tutor] Unzip a zipfile, then unzip the zipfiles within the original zip

2012-08-07 Thread Peter Otten
Gregory Lund wrote: [For improved readability please avoid # prefixes for the parts of your post that are not comments in snippets of python code] neophyte .py/pyTutor user. Welcome. I am also a university GIS lecturer. My students submit their lab assignments (zipped up into one zipfile)

Re: [Tutor] Unzip a zipfile, then unzip the zipfiles within the original zip

2012-08-07 Thread Mark Lawrence
On 07/08/2012 18:10, Gregory Lund wrote: # neophyte .py/pyTutor user. # I am also a university GIS lecturer. My students submit their lab assignments (zipped up into one zipfile) to a depository, which I download as a single zip containing all 40 students' zipfiles. # Goal: unzip a zipfile of

Re: [Tutor] Unzip a zipfile, then unzip the zipfiles within the original zip

2012-08-07 Thread Ramchandra Apte
I think a shell command (but I think you are using Windows) would be best for this task. You can unzip the file in memory and then unzip the smaller ones. There is no need to create any files. [snip] Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: