Re: [Tutor] Testing print

2016-10-01 Thread boB Stepp
On Sat, Oct 1, 2016 at 7:19 PM, Alan Gauld via Tutor wrote: > On 01/10/16 23:08, boB Stepp wrote: >> On Sat, Oct 1, 2016 at 11:35 AM, Alan Gauld via Tutor >> wrote: >> >>> ... Personally I don't like functions that >>> sometimes return one and sometimes two results. I'd rather >>> you returned a

Re: [Tutor] Testing print

2016-10-01 Thread Alan Gauld via Tutor
On 01/10/16 23:08, boB Stepp wrote: > On Sat, Oct 1, 2016 at 11:35 AM, Alan Gauld via Tutor > wrote: > >> ... Personally I don't like functions that >> sometimes return one and sometimes two results. I'd rather >> you returned a None first argument in the first case >> to make it consistent. >

Re: [Tutor] Testing print

2016-10-01 Thread boB Stepp
On Sat, Oct 1, 2016 at 11:35 AM, Alan Gauld via Tutor wrote: > ... Personally I don't like functions that > sometimes return one and sometimes two results. I'd rather > you returned a None first argument in the first case > to make it consistent. Why don't you like doing this? What are the plus

Re: [Tutor] Unsubscribe

2016-10-01 Thread boB Stepp
Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor -- boB ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/

Re: [Tutor] receiving regular expression from command line

2016-10-01 Thread Alan Gauld via Tutor
On 01/10/16 09:16, anish singh wrote: > I am trying to implement grep to just increase my knowledge > about regular expression. > > Below is the program usage: > python test.py -i Documents/linux/linux/ -s '\w+_readalarm*' > > However, due to my lack of knowledge about string handling > in python

Re: [Tutor] Testing print

2016-10-01 Thread Alan Gauld via Tutor
On 01/10/16 16:12, boB Stepp wrote: >>> This module will take a string and right justify it so that the last >>> character >>> of the line will fall in column 70 of the display. The results will be >>> printed to stdout.''' >>> >> Do you need print_msgs()? >> Won't it work the same with >> >>

[Tutor] receiving regular expression from command line

2016-10-01 Thread anish singh
I am trying to implement grep to just increase my knowledge about regular expression. Below is the program usage: python test.py -i Documents/linux/linux/ -s '\w+_readalarm*' However, due to my lack of knowledge about string handling in python, I am getting wrong results. def read_file(file, pat

[Tutor] Unsubscribe

2016-10-01 Thread spawgi
On Sat, Oct 1, 2016 at 8:12 AM, boB Stepp wrote: > On Sat, Oct 1, 2016 at 2:02 AM, Alan Gauld via Tutor > wrote: > > On 01/10/16 05:24, boB Stepp wrote: > > > >> > === > >> '''Exerise 3.1 from "Think Python 2" by Allen

Re: [Tutor] Testing print

2016-10-01 Thread boB Stepp
On Sat, Oct 1, 2016 at 2:02 AM, Alan Gauld via Tutor wrote: > Do you need print_msgs()? > Won't it work the same with > >print(right_justify(input_string)) > > You are only feeding one line at a time into the print msgs. > > You could do it all in a new print_msgs() like: > > def prin

Re: [Tutor] Testing print

2016-10-01 Thread boB Stepp
On Sat, Oct 1, 2016 at 2:02 AM, Alan Gauld via Tutor wrote: > On 01/10/16 05:24, boB Stepp wrote: > >> === >> '''Exerise 3.1 from "Think Python 2" by Allen Downey. >> >> This module will take a string and right justify it

Re: [Tutor] Testing print

2016-10-01 Thread Alan Gauld via Tutor
On 01/10/16 05:24, boB Stepp wrote: > === > '''Exerise 3.1 from "Think Python 2" by Allen Downey. > > This module will take a string and right justify it so that the last character > of the line will fall in column 70 of