[Tutor] P4Python silent Installation

2012-01-25 Thread Nitish Mahajan
Hi, I use Python 2.5 and hence consequently use the file P4Python-1.0.win32-py2.5.exe in order to add the Perforce APIs. I would like to create a silent installation for them. Python 2.5 being an msi is easily run silently using /q but the other file “P4Python-1.0.win32-py2.5.exe” doesnot accept

Re: [Tutor] P4Python silent Installation

2012-01-25 Thread Steven D'Aprano
Nitish Mahajan wrote: I use Python 2.5 and hence consequently use the file P4Python-1.0.win32-py2.5.exe in order to add the Perforce APIs. I would like to create a silent installation for them. Hello Nitish, This mailing list is for people interested in learning the language Python, not for

[Tutor] how to read and write to a file

2012-01-25 Thread ken brockman
I would like to write to and read from a file from python. I wanted to use the file to save input to the program in a list. I have been looking around and there seems to be several ways to go about it. I tried pickling, but am having an issue with it. What would be the correct way to accomplish

Re: [Tutor] how to read and write to a file

2012-01-25 Thread Alexander
On Wed, Jan 25, 2012 at 7:19 AM, ken brockman wrote: > I would like to write to and read from a file from python. I wanted to use > the file to save input to the program in a list. I have been looking around > and there seems to be several ways to go about it. I tried pickling, but am > having an

Re: [Tutor] how to read and write to a file

2012-01-25 Thread Alexander
On Wed, Jan 25, 2012 at 8:32 AM, ken brockman wrote: > > > > From: Alexander > To: ken brockman > Cc: "tutor@python.org" > Sent: Wednesday, January 25, 2012 7:38 AM > Subject: Re: [Tutor] how to read and write to a file > > > > On Wed, Jan 25, 2012 at 7:19 AM, k

Re: [Tutor] how to read and write to a file

2012-01-25 Thread Joel Goldstick
On Wed, Jan 25, 2012 at 9:14 AM, Alexander wrote: > On Wed, Jan 25, 2012 at 8:32 AM, ken brockman wrote: >> >> >> >> From: Alexander >> To: ken brockman >> Cc: "tutor@python.org" >> Sent: Wednesday, January 25, 2012 7:38 AM >> Subject: Re: [Tutor] how to read a

Re: [Tutor] how to read and write to a file

2012-01-25 Thread Joel Goldstick
On Wed, Jan 25, 2012 at 10:50 AM, ken brockman wrote: > Thank you Joel and Alexander for your time and input. > I had just wanted to be able to store a list and read and write to it. But > it seems reading and writing is no go with lists, only strings, or no? Is > there a simply way I can tweak th

Re: [Tutor] how to read and write to a file

2012-01-25 Thread ken brockman
Okay, got ya. Mea Culpa. Being misanthropic by nature I've not used or engaged in a interactive forum such as this one before . I do grasp that a list is more then just the information it contains. So, does that mean i go with pickling? And can I save two lists in one pickled file, or no? T

Re: [Tutor] how to read and write to a file

2012-01-25 Thread Joel Goldstick
On Wed, Jan 25, 2012 at 11:30 AM, ken brockman wrote: > Okay, got ya. Mea Culpa. > Being misanthropic by nature I've not used or engaged  in a interactive > forum such as this one before . > I do grasp that a list is more then just the information it contains. So, > does that mean i go with pickli

Re: [Tutor] how to read and write to a file

2012-01-25 Thread ken brockman
Joel, thanks your first suggest worked great, except that it only reads my first item instead of the whole list. I will have to do some more research on the topic, but i do appreciate your giving me a leg up. Also I don't understand why my last response was once again at the top of the list? I

Re: [Tutor] how to read and write to a file

2012-01-25 Thread Steven D'Aprano
Joel Goldstick wrote: First of all, always remember to reply to all on the list. That keeps everyone in the loop. Second, don't 'top post'. Write your comments at the end of the thread so that people can follow the conversation. Sometimes its useful to intersperse comments in someone's previo

Re: [Tutor] how to read and write to a file

2012-01-25 Thread Steven D'Aprano
Steven D'Aprano wrote: (And yes, I deliberately had one fewer answer than question in the second case. Top posting makes it MUCH easier to miss questions.) Gah! Brain fart! Please ignore the comment in parentheses. -- Steven ___ Tutor maillist -

Re: [Tutor] how to read and write to a file

2012-01-25 Thread Marc Tompkins
On Wed, Jan 25, 2012 at 3:30 PM, Steven D'Aprano wrote: > Steven D'Aprano wrote: > > (And yes, I deliberately had one fewer answer than question in the second >> case. Top posting makes it MUCH easier to miss questions.) >> > > Gah! Brain fart! Please ignore the comment in parentheses. > And I t

[Tutor] Error Checking/Defensive Programming

2012-01-25 Thread Michael Lewis
Hi everyone, I am new to python and have a noob question. Is it generally better to use try/except/else statements or if/elif/else? Or, is there a time and place for each? For a simple example, assume I want a user to enter a number 1) try: number = float(input('enter a number: ') exc

Re: [Tutor] Error Checking/Defensive Programming

2012-01-25 Thread Devin Jeanpierre
On Wed, Jan 25, 2012 at 10:36 PM, Michael Lewis wrote: > Is it generally better to use try/except/else statements or if/elif/else? > Or, is there a time and place for each? There's a time and place for each. Most errors are indicated in the form of an exception being raised, though. > For a simp

Re: [Tutor] Error Checking/Defensive Programming

2012-01-25 Thread Steve Willoughby
On 25-Jan-12 19:49, Devin Jeanpierre wrote: On Wed, Jan 25, 2012 at 10:36 PM, Michael Lewis wrote: if number>=0 or< 0: As long as we're helping with this, I'll just add a comment about this conditional statement. First, if you string together two expressions with "or" between them, t

Re: [Tutor] Error Checking/Defensive Programming

2012-01-25 Thread Modulok
It's easier to ask for forgiveness than permission. Ask yourself "Is this an action that could fail in a specific way?" If yes, you need try/except. If no, you probably need if/else. When dealing with data such as user input or opening files and so forth, use try/except. When those actions fail, th