[Tutor] Read-create-edit file

2009-12-13 Thread biboy mendz
Hi list, I finally manage to sort of complete my read-create-edit.py file (after finding precious free time). I appreciate your review and good/bad comments to my code. It look and runs ok from my side here :-) #read_create_edit.py #!/usr/bin/env python # -*- coding: utf-8 -*- ''' Exercise 3

Re: [Tutor] Append mode dilemma

2009-12-09 Thread biboy mendz
-- Regards, bibs M. Host/Kernel/OS "cc02695" running Linux 2.6.31-5.slh.4-sidux-686 [sidux 2009-02 Αιθήρ - kde-full - (200907141427) ] www.sidux.com Albert Sweigart wrote: Your problem is on this line: fobj.write('\n'.join(all)) This puts a newline in between each line in "all", but

Re: [Tutor] Append mode dilemma

2009-12-09 Thread biboy mendz
Luke Paireepinart wrote: That's because there is NOT a new line at the end of the file. It's a file you're appending to, it's up to YOU to create that new line. And all files should end with newlines anyway (on linux). So modify your code so that you output a new line at the end of your output

Re: [Tutor] Append mode dilemma

2009-12-09 Thread biboy mendz
Luke Paireepinart wrote: On Wed, Dec 9, 2009 at 12:11 PM, biboy mendz <mailto:bibsmen...@gmail.com>> wrote: Hello all! I'm trying to use the append mode when opening and writing to a file but i cant get it to work my way. When run in the present code, the u

[Tutor] Append mode dilemma

2009-12-09 Thread biboy mendz
Hello all! I'm trying to use the append mode when opening and writing to a file but i cant get it to work my way. When run in the present code, the user inputs are expectedly 'appended' but not in a newline below the last line of the existing file. Instead it starts from where the last line end.

Re: [Tutor] Equivalent exception of os.path.exists()

2009-11-30 Thread biboy mendz
spir wrote: What is your question? If it's about the type of exception raised when os.path.exists fails, well, sure it's hard to find: print os.path.exists("foo".bar) ==> False My question is: i'm looking for type of exception that more or less equivalent to os.path.exists attribute

[Tutor] Equivalent exception of os.path.exists()

2009-11-30 Thread biboy mendz
http://pastebin.ca/1693849 This is end-of-chapter3 exercise of the book Core Python Programming. I'm reading/searching in the book and other materials but is unsuccessful. There are at least 50 exceptions listed but I can't find anything close. I commented out my modified script to just what

Re: [Tutor] Question re: hangman.py

2009-11-13 Thread biboy mendz
thanks a lot for the clarification Alan and all. -- Regards, bibs M. Host/Kernel/OS "cc02695" running Linux 2.6.31-5.slh.4-sidux-686 [sidux 2009-02 Αιθήρ - kde-full - (200907141427) ] www.sidux.com Alan Gauld wrote: "biboy mendz" wrote chapter 8: hangman.py

[Tutor] Question re: hangman.py

2009-11-13 Thread biboy mendz
http://inventwithpython.com chapter 8: hangman.py expression is: print(letter, end=' ') it explained: end keyword argument in print() call makes the print() function put a space character at the end of the string instead of a newline. however when run it gives error: SyntaxError: invalid synta