Re: [Tutor] String Attribute

2015-08-01 Thread Emile van Sebille
On 8/1/2015 4:21 PM, Ltc Hotspot wrote: Hi Emile, Question: What is the source of the line 7 syntax: mbox.split? I read mbox from the file. eg, mbox = open("mbox-short.txt",'r').read() and it looks to me that if you insert the above in front of the for loop below you'll get further. Emil

Re: [Tutor] String Attribute

2015-08-01 Thread Emile van Sebille
On 8/1/2015 4:07 PM, Ltc Hotspot wrote: Hi Alan, Question1: The output result is an address or line? It's a set actually. Ready to be further processed I imagine. Or to print out line by line if desired. Question2: Why are there 54 lines as compared to 27 line in the desired output? Be

Re: [Tutor] String Attribute

2015-08-01 Thread Alan Gauld
On 02/08/15 00:07, Ltc Hotspot wrote: Question1: The output result is an address or line? Its your assignment,. you tell me. But from your previous mails I'm assuming you want addresses? Question2: Why are there 54 lines as compared to 27 line in the desired output? Because the set removes

Re: [Tutor] OT: Test to see if ibisMail app is truly sending in plain text

2015-08-01 Thread D Wyatt
I just looked it up. it means Looks Good to Me. On Sat, Aug 1, 2015 at 10:16 AM, Steven D'Aprano wrote: > On Sat, Aug 01, 2015 at 04:53:45PM +0100, Mark Lawrence wrote: > > > LGTM. > > Let's Get The Money? > > -- > Steve > ___ > Tutor maillist - Tu

Re: [Tutor] String Attribute

2015-08-01 Thread Ltc Hotspot
Hi Alan, Question1: The output result is an address or line? Question2: Why are there 54 lines as compared to 27 line in the desired output? Here is the latest revised code: fname = raw_input("Enter file name: ") if len(fname) < 1 : fname = "mbox-short.txt" fh = open(fname) count = 0 addresses =

Re: [Tutor] String Attribute

2015-08-01 Thread Ltc Hotspot
Hi Emile, Question: What is the source of the line 7 syntax: mbox.split? Here is a copy of the Traceback message: NameError Traceback (most recent call last) C:\Users\vm\Desktop\apps\docs\Python\8_5_v_26.py in () 5 addresses = set() 6 for addr in [ fromline.split()[0] > 7 for f

Re: [Tutor] a puzzle about -3**2 vs (-3)**2

2015-08-01 Thread D Wyatt
> > According to Wikipedia: > > https://en.wikipedia.org/wiki/Order_of_operations > > some scientific journals now treat multiplication as a higher precedence > than division with a / so that 1/2x equals 1/(2x), not (1/2)x. > > There's an interesting study done here: > > "Developer beliefs about b

Re: [Tutor] email validation

2015-08-01 Thread Emile van Sebille
On 8/1/2015 10:54 AM, Quiles, Stephanie wrote: Hello All, I have a python assignment. I have to make sure that when user inputs email that the program verifies that the address as a @ and a “.” in the entry or else return an invalid email error. A Very rudimentary form of email validation. i c

Re: [Tutor] String Attribute

2015-08-01 Thread Emile van Sebille
On 8/1/2015 12:00 PM, Ltc Hotspot wrote: Hi Everyone: Let me repost the question: You will parse the From line using split() and print out the second word in the line (i.e. the entire address of the person who sent the message). Then print out a count at the end. *Hint:* make sure not to incl

Re: [Tutor] email validation

2015-08-01 Thread Danny Yoo
On Sat, Aug 1, 2015 at 2:03 PM, Válas Péter wrote: > Hi Stephanie, > > the function should be defined first, and used after. So put it before > main(). It's perfectly legal and ok to say: ### def main(): callHelper() def callHelper(): print("I am the helper")

Re: [Tutor] email validation

2015-08-01 Thread Danny Yoo
All your function definitions should be defined with 'def' at the leftmost margin. However, the line in your program that starts with "def open_existing_file()..." is not flush with the margin. Python has, subsequently, thought that the definition of the function is scoped locally. Move the begi

Re: [Tutor] email validation

2015-08-01 Thread Válas Péter
Hi Stephanie, the function should be defined first, and used after. So put it before main(). Also, "if '@' not in email and '.' not in email:" seems to be erroneous. You want both be present; this is an AND if you state it and becomes OR when you deny. if '@' not in email or '.' not in email: In

Re: [Tutor] infix to postfix exponent handling

2015-08-01 Thread Danny Yoo
> i also replaced the infixtopostfix to the problem: > > ("5 * 3 ^ (4 - 2)”)) > > here is the error I am getting : > > Traceback (most recent call last): > File "/Users/stephaniequiles/Downloads/Listings/listing_3_7.py", line 53, > in > print(infixToPostfix("5 * 3 ^ (4 - 2)")) > File "/Us

Re: [Tutor] String Attribute

2015-08-01 Thread Alan Gauld
On 01/08/15 19:48, Ltc Hotspot wrote: There is an indent message in the revised code. Question: Where should I indent the code line for the loop? Do you understand the role of indentation in Python? Everything in the indented block is part of the structure, so you need to indent everything that

[Tutor] email validation

2015-08-01 Thread Quiles, Stephanie
Hello All, I have a python assignment. I have to make sure that when user inputs email that the program verifies that the address as a @ and a “.” in the entry or else return an invalid email error. A Very rudimentary form of email validation. i cannot get the program to work. Here is what i

Re: [Tutor] String Attribute

2015-08-01 Thread Ltc Hotspot
Hi Everyone: Let me repost the question: You will parse the From line using split() and print out the second word in the line (i.e. the entire address of the person who sent the message). Then print out a count at the end. *Hint:* make sure not to include the lines that start with 'From:'. You

[Tutor] infix to postfix exponent handling

2015-08-01 Thread Quiles, Stephanie
My assignment calls for the program to be edited to handle the “^” symbol. the hint is that it should be done with just one line of code. Here is the assignment: Modify the infix-to-postfix algorithm to handle exponentiation. Use the ^ symbol as the input token for testing. Q-14: Modify the inf

Re: [Tutor] String Attribute

2015-08-01 Thread Ltc Hotspot
Hi Emile, I just noticed there are duplicates Here is the complete line output as requested, below: stephen.marqu...@uct.ac.za lo...@media.berkeley.edu zq...@umich.edu rjl...@iupui.edu zq...@umich.edu rjl...@iupui.edu c...@iupui.edu c...@iupui.edu gsil...@umich.edu gsil...@umich.edu zq...@umich

Re: [Tutor] String Attribute

2015-08-01 Thread Ltc Hotspot
Hi Alan, There is an indent message in the revised code. Question: Where should I indent the code line for the loop? View the revised codes with loop indents, below: --->Revised Code v.2 wo/indent from lines 8-12: fname = raw_input("Enter file name: ") if len(fname) < 1 : fname = "mbox-short.t

Re: [Tutor] FETCH URLs FROM WEBSITE

2015-08-01 Thread Válas Péter
2015-08-01 19:42 GMT+02:00 Alan Gauld : > c) The separate page is not static HTML (or even server >generated HTML) it is created in part by the Javascript >code when the page loads. That means it is very likely to >change on each load (possibly deliberately so to foil robots!) > I di

Re: [Tutor] FETCH URLs FROM WEBSITE

2015-08-01 Thread Válas Péter
2015-08-01 12:48 GMT+02:00 Gaurav Lathwal : > Hello everyone, I am new to Python, so please forgive me if my question is > too dumb. > I want to write a script that automatically downloads all the videos hosted > on this site :- > > http://www.toonova.com/batman-beyond > > Now, the problem I am ha

Re: [Tutor] FETCH URLs FROM WEBSITE

2015-08-01 Thread Alan Gauld
On 01/08/15 11:48, Gaurav Lathwal wrote: I want to write a script that automatically downloads all the videos hosted on this site :- http://www.toonova.com/batman-beyond The first thing to ask is whether they allow robotic downloads from the site. If they are funded by advertising then they m

Re: [Tutor] How to design object interactions with an SQLite db?

2015-08-01 Thread Mark Lawrence
On 01/08/2015 17:34, boB Stepp wrote: I have never written programs to interact with a db. I have never written an OO program. So this is getting interesting rather quickly! As I continue to ponder my project design, I see many of the classes I wish to create map naturally to db tables. For

Re: [Tutor] How to design object interactions with an SQLite db?

2015-08-01 Thread Alan Gauld
On 01/08/15 17:34, boB Stepp wrote: I have never written programs to interact with a db. I have never written an OO program. The mapping opf OOP to Relational DB is one of the on going debates in OOP land, and has been since I started with OOP in 1984... 1) Create my various objects normal

Re: [Tutor] OT: Test to see if ibisMail app is truly sending in plain text

2015-08-01 Thread boB Stepp
Well, in replying to your message, Steve, I see that this is not the perfect iPad solution. After hitting reply all, it failed to give attribution to your comments. But as I have not been able to find anything better, I guess I can manually add attribution names, and make this work on the rare

Re: [Tutor] OT: Test to see if ibisMail app is truly sending in plain text

2015-08-01 Thread Steven D'Aprano
On Sat, Aug 01, 2015 at 04:53:45PM +0100, Mark Lawrence wrote: > LGTM. Let's Get The Money? -- Steve ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] FETCH URLs FROM WEBSITE

2015-08-01 Thread Gaurav Lathwal
Hello everyone, I am new to Python, so please forgive me if my question is too dumb. I want to write a script that automatically downloads all the videos hosted on this site :- http://www.toonova.com/batman-beyond Now, the problem I am having is, I am unable to fetch the video urls of all the vid

Re: [Tutor] a puzzle about -3**2 vs (-3)**2

2015-08-01 Thread Emile van Sebille
On 8/1/2015 9:43 AM, Steven D'Aprano wrote: The bottom line is, there is no universal right or wrong answer for the precedence rules for operators, although some rules are less right than others. My bottom line is that the liberal use of parens reconciles them all, particularly for any humans

Re: [Tutor] OT: Test to see if ibisMail app is truly sending in plain text

2015-08-01 Thread Steven D'Aprano
On Sat, Aug 01, 2015 at 10:27:27AM -0500, boB Stepp wrote: > I apologize for the noise, but I felt it better to get this question > answered definitively prior to posting questions from my iPad. > > I am on a brief vacation and only brought my iPad. I have been having > a devil of a time searc

Re: [Tutor] a puzzle about -3**2 vs (-3)**2

2015-08-01 Thread Steven D'Aprano
Hi Deb, On Fri, Jul 31, 2015 at 10:20:50AM -0700, D Wyatt wrote: > > > > > This matches the precedence rules for written mathematics, where negation > > has a lower precedence than exponentiation as well. So python is doing the > > correct thing here mathematically. See, for example, > > http:/

[Tutor] How to design object interactions with an SQLite db?

2015-08-01 Thread boB Stepp
I have never written programs to interact with a db. I have never written an OO program. So this is getting interesting rather quickly! As I continue to ponder my project design, I see many of the classes I wish to create map naturally to db tables. For instance the class Student can potenti

Re: [Tutor] String Attribute

2015-08-01 Thread Emile van Sebille
Hi Hal, Seeing now that the output is only extracted from six address blocks, can you paste in the full contents of the file mbox-short.txt? (or the first 5-10 address sets if this is only representative) I think if we have a better understanding of the structure of the content you're parsin

Re: [Tutor] OT: Test to see if ibisMail app is truly sending in plain text

2015-08-01 Thread Mark Lawrence
On 01/08/2015 16:27, boB Stepp wrote: I apologize for the noise, but I felt it better to get this question answered definitively prior to posting questions from my iPad. I am on a brief vacation and only brought my iPad. I have been having a devil of a time searching the Internet for an iPad

[Tutor] OT: Test to see if ibisMail app is truly sending in plain text

2015-08-01 Thread boB Stepp
I apologize for the noise, but I felt it better to get this question answered definitively prior to posting questions from my iPad. I am on a brief vacation and only brought my iPad. I have been having a devil of a time searching the Internet for an iPad app that will truly send and display in

Re: [Tutor] String Attribute

2015-08-01 Thread Cameron Simpson
On 31Jul2015 17:21, Ltc Hotspot wrote: Mark: Is this any better, message sent from GMail? Regards, Hal Looks better to me. Cheers, Cameron Simpson On Fri, Jul 31, 2015 at 5:02 PM, Mark Lawrence wrote: On 31/07/2015 19:57, ltc.hots...@gmail.com wrote: I believe that this is the third ti

Re: [Tutor] String Attribute

2015-08-01 Thread Alan Gauld
On 01/08/15 00:59, ltc.hots...@gmail.com wrote: for line in fh: line2 = line.strip() line3 = line2.split() line4 = line3[0] →→Apparently, the data content in the file is lost from the address sort function to line2? : It is not lost, it is an empty line. In [47]: print line2.sp

Re: [Tutor] String Attribute

2015-08-01 Thread Ltc Hotspot
Mark: Is this any better, message sent from GMail? Regards, Hal On Fri, Jul 31, 2015 at 5:02 PM, Mark Lawrence wrote: > On 31/07/2015 19:57, ltc.hots...@gmail.com wrote: > > I believe that this is the third time that you've been asked to do > something about the amount of whitespace that you're

Re: [Tutor] String Attribute

2015-08-01 Thread Ltc Hotspot
Hi Mark, Desired output on execution of the script: stephen.marqu...@uct.ac.za lo...@media.berkeley.edu zq...@umich.edu rjl...@iupui.edu zq...@umich.edu rjl...@iupui.edu [...] Regards, Hal On Fri, Jul 31, 2015 at 5:21 PM, Ltc Hotspot wrote: > Mark: > Is this any better, message sent from G

Re: [Tutor] String Attribute

2015-08-01 Thread ltc.hotspot
Sent from Surface From: Alan Gauld Sent: ‎Friday‎, ‎July‎ ‎31‎, ‎2015 ‎4‎:‎54‎ ‎PM To: Tutor@python.org On 31/07/15 19:57, ltc.hots...@gmail.com wrote: > for line in fh: > line2 = line.strip() > line3 = line2.split() > line4 = line3[0] You need to check that there actually