Re: [Tutor] Step Value

2011-06-16 Thread Válas Péter
Please try to reply to the previous letters instead of starting a new thread each time. Thank you! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] Step Value

2011-06-16 Thread Vincent Balmori
"def spam(n=3):     """Return n slices of yummy spam."""     return "spam "*n And here it is in use: >>> spam(4) 'spam spam spam spam ' >>> spam()  # just use the default 'spam spam spam ' Can you see what I did to set the default value for n? Read the function definition line "def spam... " ca

Re: [Tutor] File parsing

2011-06-16 Thread Steven D'Aprano
Neha P wrote: Thanks James I guess i have to use the same code for text in yellow... seems like ther's no other way... What code in yellow? I see no code in yellow. This is email, don't assume people can see colours. They may have HTML blocked or turned off (very important for security, avo

Re: [Tutor] Step Value

2011-06-16 Thread Steven D'Aprano
Vincent Balmori wrote: Okay, I think I understand it better for the quesiton: "Improve the function ask_number() so that the function can be called with a step value. Make the default value of step 1." Here is the improved function and the human_move function that calls it later on. The thing

[Tutor] Step Value

2011-06-16 Thread Vincent Balmori
"From Steven D'Aprono: * change the ask_number function to accept a fourth argument; * make it optional rather than required; * give it a sensible default value; * within the function, that value must then be passed to range " Okay, I think I understand it better for the quesiton: "Improve the fun

Re: [Tutor] File parsing

2011-06-16 Thread G . nius . ck
instead of 14 last_char = eachline[len(eachline)-1] do 14 last_char = eachline[-1] #Which is shorter but the same thing On , spa...@gmail.com wrote: Hello Neha, I think this script will do what you want and will also fix some of the issues in your original code - ---

Re: [Tutor] Beginner puzzle with unpacking argv

2011-06-16 Thread Lisi
On Thursday 16 June 2011 19:03:27 Joel Goldstick wrote: > On Thu, Jun 16, 2011 at 1:10 PM, Lisi wrote: > > Copied and pasted: > > >From text of Learn Python the Hard Way > > > > 1 from sys import argv > > 2 > > 3 script, user_name = argv > > > > >From my script (typed, not copied and pasted, but c

Re: [Tutor] File parsing

2011-06-16 Thread spawgi
Output on your sample input - $./file_reversing_program.py input.txt "you? are how there, Hi" you thank fine, doing am I. On Fri, Jun 17, 2011 at 1:26 AM, wrote: > Hello Neha, > > I think this script will do what you want and will also fix some of the > issues in your original code - > --

Re: [Tutor] File parsing

2011-06-16 Thread spawgi
Hello Neha, I think this script will do what you want and will also fix some of the issues in your original code - 1 #! /usr/bin/python 2 3 import curses.ascii 4 import string 5 import sys 6 7 with open(sys.argv[1],'r') as inpu

Re: [Tutor] File parsing

2011-06-16 Thread Lisi
Thanks, Neha. I am sending this back on list so that those who are more knowledgeable than I am can help you. On Thursday 16 June 2011 18:47:39 Neha P wrote: > Hi Lisi, > Below is the code and I have prefixed(-->) to the line code which i'm > mainly concerned about and have commented using # >

Re: [Tutor] File parsing

2011-06-16 Thread Neha P
Thanks James I guess i have to use the same code for text in yellow... seems like ther's no other way...  Regards, Neha From: James Reynolds To: Neha P Cc: "tutor@python.org" Sent: Thursday, June 16, 2011 2:43 PM Subject: Re: [Tutor] File parsing use split

Re: [Tutor] Beginner puzzle with unpacking argv

2011-06-16 Thread Peter Lavelle
If you need to process command line arguments then the argparse module may also be useful to you. More info can be found here: http://docs.python.org/library/argparse.html Regards Peter Lavelle On 16/06/11 19:03, Steve Willoughby wrote: On 16-Jun-11 10:10, Lisi wrote: 1 from sys import arg

Re: [Tutor] File parsing

2011-06-16 Thread James Reynolds
use split on the list to split it up. search each element for something like: if '"' == element[:-1]: if that evaluation is True, I would remove the quote mark from the word on the right side, and place a new one on the left side using something like '"' + element. I would do the same thing for

Re: [Tutor] Beginner puzzle with unpacking argv

2011-06-16 Thread Joel Goldstick
On Thu, Jun 16, 2011 at 1:10 PM, Lisi wrote: > Copied and pasted: > >From text of Learn Python the Hard Way > > 1 from sys import argv > 2 > 3 script, user_name = argv > > >From my script (typed, not copied and pasted, but copied and pasted from > my > script to here): > > 1 from sys import argv

Re: [Tutor] Beginner puzzle with unpacking argv

2011-06-16 Thread Steve Willoughby
On 16-Jun-11 10:10, Lisi wrote: 1 from sys import argv 2 3 script, user_name = argv I have tried every permutation of white space I could think of that might have looked like the original, but I always get the same error: That will work ONLY if argv has at least 2 values in it. Your source

[Tutor] Beginner puzzle with unpacking argv

2011-06-16 Thread Lisi
Copied and pasted: >From text of Learn Python the Hard Way 1 from sys import argv 2 3 script, user_name = argv >From my script (typed, not copied and pasted, but copied and pasted from my script to here): 1 from sys import argv 2 3 script, user_name = argv I have tried every permutation of wh

Re: [Tutor] Weird tkFont behavior

2011-06-16 Thread Steve Willoughby
On 16-Jun-11 09:52, Steve Willoughby wrote: I'm probably just doing something stupid, but I can't spot the error. I hope someone here can see what I'm looking past, or knows of a known issue with these widgets. I think I solved it, actually.. as I was typing this up, I wondered in passing abou

[Tutor] File parsing

2011-06-16 Thread Neha P
Hi all, I know below query may sound silly, but can somebody suggest any better way of doing this: It would be helpful. I need to read a file line by line and print each line starting from the last word first:   C:\Python26>type file_reversing_program.txt import sys import string f_obj=open(s

[Tutor] Weird tkFont behavior

2011-06-16 Thread Steve Willoughby
I'm probably just doing something stupid, but I can't spot the error. I hope someone here can see what I'm looking past, or knows of a known issue with these widgets. I'm writing a GUI app using ttk widgets in Tkinter, which includes text displayed in a regular text widget. Some text in the

Re: [Tutor] GTALK and PYTHON

2011-06-16 Thread Timo
On 16-06-11 11:00, Dipo Elegbede wrote: Hi All, I want to write an application in python with which I can log into gtalk. Kindly point me to any documentation with which I can move on. Not to be rude, but did you use Google before asking here? There are a lot of examples and how-to's. You coul

Re: [Tutor] Tutor Digest, Vol 88, Issue 56

2011-06-16 Thread Steven D'Aprano
WolfRage wrote: CODE BELOW #!/usr/bin/python3 """With this method I can make the class "Screen" become "stdscr" but if I refernce any of the new methods or properties the applications promptly fails and notifies me that the attribute does not exist.""" That's because it doesn't exist.

Re: [Tutor] using python to write web page

2011-06-16 Thread Alan Gauld
"Walter Prins" wrote Have a look at the Pyjamas project: http://pyjs.org/ It sounds like what you want. I hadn't considered using pyjamas outside a web server environment but I guess you could since it just creates an html/javascript file. It depends on what the OP wants to put in his "we

Re: [Tutor] using python to write web page

2011-06-16 Thread Walter Prins
Have a look at the Pyjamas project: http://pyjs.org/ It sounds like what you want. Walter ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] GTALK and PYTHON

2011-06-16 Thread Dipo Elegbede
Hi All, I want to write an application in python with which I can log into gtalk. Kindly point me to any documentation with which I can move on. Advices too would be of great help.. Thanks. -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutio

Re: [Tutor] using python to write web page

2011-06-16 Thread ALAN GAULD
From: Michael bridges To: ALAN GAULD Sent: Thursday, 16 June, 2011 1:07:14 Subject: Re: [Tutor] using python to write web page > your python code includes html. OK, Now I understand. > i write the python only code --> web page > [ do not care if it is html,