[Tutor] find pickle and retrieve saved data

2015-08-02 Thread Quiles, Stephanie
how do i go about being able to add a feature to search for individual entries that have been saved into that dictionary or else tell me that the name I entered is not found? Here is the code that i have so far… import pickle def main(): infile = open("emails.dat", "rb") emails = pick

Re: [Tutor] infix to postfix eval

2015-08-02 Thread Anish Tambe
On Sun, Aug 2, 2015 at 9:39 AM, Quiles, Stephanie wrote: > > hello again! > > I have to unify these methods so that i can enter an infix, convert it to a > postfix and then solve. Here are the methods At the end of your code I added this - inFixExpr = raw_input("Enter infix string : ") postFixE

Re: [Tutor] scratching my head

2015-08-02 Thread Válas Péter
2015-08-02 23:44 GMT+02:00 Clayton Kirkwood : > > > for dir_path, directories, files in os.walk(main_dir): > for file in files: > #print( " file = ", file) > # if( ("(\.jpg|\.png|\.avi|\.mp4)$") not in file.lower() ): > > > I supppose you want to use regular expressions here and

Re: [Tutor] scratching my head

2015-08-02 Thread Laura Creighton
I think people are giving you sub-optimal advice. Python has a module in the standard library for doing exactly what you want to do -- match files with certain extensions. See: https://docs.python.org/2/library/fnmatch.html It's unix style file matching, but I am fairly certain this works on win

Re: [Tutor] Windows "feature" I don't understand

2015-08-02 Thread Válas Péter
My "best practice" is to avoid Windows-generated directories and create my own ones. :-) They are linked and "pseudo-named" in a really messy way even if you use English Windows, but the real extended horror begins at different languages where Windows randomly uses English and translated names. Als

[Tutor] Windows "feature" I don't understand

2015-08-02 Thread Clayton Kirkwood
In a former life, I played the part of a system manager in a number of Unix environments, which I really liked. Now, I am stuck using Windows and don't get into the innards much. I ran into a problem in my program, which we have been discussing, which is windows-caused. I originally set my director

Re: [Tutor] scratching my head

2015-08-02 Thread Clayton Kirkwood
> -Original Message- > From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On > Behalf Of Steven D'Aprano > Sent: Sunday, August 02, 2015 5:49 PM > To: tutor@python.org > Subject: Re: [Tutor] scratching my head > > On Sun, Aug 02, 2015 at 02:44:15PM -0700, Clayton Kirkwood w

Re: [Tutor] scratching my head

2015-08-02 Thread Clayton Kirkwood
> -Original Message- > From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On > Behalf Of Cameron Simpson > Sent: Sunday, August 02, 2015 6:03 PM > To: tutor@python.org > Subject: Re: [Tutor] scratching my head > > On 02Aug2015 16:15, Clayton Kirkwood wrote: > >> Behalf Of

Re: [Tutor] scratching my head

2015-08-02 Thread Cameron Simpson
On 02Aug2015 16:15, Clayton Kirkwood wrote: Behalf Of Cameron Simpson Sent: Sunday, August 02, 2015 3:35 PM [...] Personally I'd be reaching for os.path.splitext. Untested example below: from os.path import splitext for dir_path, directories, files in os.walk(main_dir): for fil

Re: [Tutor] scratching my head

2015-08-02 Thread Steven D'Aprano
On Sun, Aug 02, 2015 at 11:46:31PM +0100, Alan Gauld wrote: > On 02/08/15 23:01, Alan Gauld wrote: > > >found = False > >for s in (".jpg",".png",".avi",".mp4"): > > found = test or (s in file.lower()) > > Oops, that should be: > > found = found or (s in file.lower()) extensions = (".jpg",".

Re: [Tutor] scratching my head

2015-08-02 Thread Steven D'Aprano
On Sun, Aug 02, 2015 at 02:44:15PM -0700, Clayton Kirkwood wrote: > for dir_path, directories, files in os.walk(main_dir): > for file in files: > #print( " file = ", file) > # if( ("(\.jpg|\.png|\.avi|\.mp4)$") not in file.lower() ): > #if( (".jpg" or ".png" or ".avi" or

Re: [Tutor] email validation

2015-08-02 Thread Quiles, Stephanie
So i took your advice and i am much closer. however, when i type in an invalid address it loops back to the first prompt and asks you to enter your name: I want it to ask you to re-enter your email address instead how would i go about this? Here is the corrected code : import pickle def mai

[Tutor] Writing back to same CSV in the next column

2015-08-02 Thread Nym City via Tutor
Hello, Below is my program where I am reading a list of IPs from a CSV file and running it through the socket module. The result of the computation is stored in a variable named ResolvedAddresses. However, there are some that are not resolved and for those there is an exception. The task that I

Re: [Tutor] email validation

2015-08-02 Thread Alan Gauld
On 02/08/15 23:54, Quiles, Stephanie wrote: So i took your advice and i am much closer. however, when i type in an invalid address it loops back to the first prompt and asks you to enter your name: I want it to ask you to re-enter your email address instead how would i go about this? Just mo

Re: [Tutor] scratching my head

2015-08-02 Thread Clayton Kirkwood
> -Original Message- > From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On > Behalf Of Cameron Simpson > Sent: Sunday, August 02, 2015 3:35 PM > To: tutor@python.org > Subject: Re: [Tutor] scratching my head > > On 02Aug2015 23:01, ALAN GAULD wrote: > >On 02/08/15 22:44,

Re: [Tutor] scratching my head

2015-08-02 Thread Alan Gauld
On 02/08/15 23:01, Alan Gauld wrote: found = False for s in (".jpg",".png",".avi",".mp4"): found = test or (s in file.lower()) Oops, that should be: found = found or (s in file.lower()) Sorry, 'test' was my first choice of name but I changed it to found later. But not everywhere :-(

Re: [Tutor] scratching my head

2015-08-02 Thread Cameron Simpson
On 02Aug2015 23:01, ALAN GAULD wrote: On 02/08/15 22:44, Clayton Kirkwood wrote: for dir_path, directories, files in os.walk(main_dir): for file in files: #print( " file = ", file) # if( ("(\.jpg|\.png|\.avi|\.mp4)$") not in file.lower() ): Python sees that as a single strin

Re: [Tutor] scratching my head

2015-08-02 Thread Clayton Kirkwood
> -Original Message- > From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On > Behalf Of Alan Gauld > Sent: Sunday, August 02, 2015 3:01 PM > To: tutor@python.org > Subject: Re: [Tutor] scratching my head > > On 02/08/15 22:44, Clayton Kirkwood wrote: > > > for dir_path, d

Re: [Tutor] scratching my head

2015-08-02 Thread Alan Gauld
On 02/08/15 22:44, Clayton Kirkwood wrote: for dir_path, directories, files in os.walk(main_dir): for file in files: #print( " file = ", file) # if( ("(\.jpg|\.png|\.avi|\.mp4)$") not in file.lower() ): Python sees that as a single string. That string is not in your filename

[Tutor] scratching my head

2015-08-02 Thread Clayton Kirkwood
Hey, been awhile, but I ran into os.walk and it fit what I needed to do for an issue I've had for a long time: I have tons of pictures in my top directory of pictures which are duplicated into properly named subdirectories. Please see issues above my questions with large gaps below. TIA, Clayton

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

2015-08-02 Thread boB Stepp
On 2 Aug 2015 Oscar Benjamin wrote: > Have you tried using the Gmail app? Yes. That is my normal mail app. > I'm using the Gmail app here on my phone. I've just looked at your message, > hit reply-all and then "respond inline". Then I can see/edit the > attribution line and your message. I've

Re: [Tutor] email validation

2015-08-02 Thread Alan Gauld
On 02/08/15 09:31, Alan Gauld wrote: them outside the main block and use them in your tests. In that case you only need one function which I'd call something like test_email() Ahem. Or you could call it is_good_address() of course! Oops! def is_good_address(addr): if '@' not in addr or

Re: [Tutor] String Attribute

2015-08-02 Thread Alan Gauld
On 02/08/15 10:15, Ltc Hotspot wrote: Question1: Why did the following strip function fail: line2 = line.strip (',') What makes you think it failed? I see no error messages below. Question2: How do I code a vertical column output See below. Revised code: fname = raw_input("Enter f

Re: [Tutor] String Attribute

2015-08-02 Thread Ltc Hotspot
Hi Alan, Question1: Why did the following strip function fail: line2 = line.strip (',') View instructions for 'str.strip([*chars*])¶ ' which is available at https://docs.pythonorg/2.7/library/stdtypes.html?highlig

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

2015-08-02 Thread Oscar Benjamin
On 1 Aug 2015 16:28, "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

Re: [Tutor] email validation

2015-08-02 Thread Alan Gauld
On 02/08/15 02:55, Quiles, Stephanie wrote: On Aug 1, 2015, at 5:17 PM, Danny Yoo wrote: Thank you, the program is now working but when the email is not entered >> correctly it doesn’t make me go back and re-enter, >> it spits out an error code but then moves on to the next field . Here is th

Re: [Tutor] String Attribute

2015-08-02 Thread Alan Gauld
On 02/08/15 02:20, Ltc Hotspot wrote: Hi Alan, I made a mistake and incorrectly assumed that differences between 54 lines of output and 27 lines of output is the result of removing duplicate email addresses, Apparently, this is not the case and I was wrong :( The solution to the problem is in t

Re: [Tutor] FETCH URLs FROM WEBSITE

2015-08-02 Thread Alan Gauld
On 02/08/15 08:30, Gaurav Lathwal wrote: & Both of you know a lot about all this, how do I go about doing that ? I mean, how do I learn that much ? I'm no expert but I've been using the web and creating web pages since 1994 and you just learn stuff as you go. So sadly I can't direct you to any

[Tutor] infix to postfix eval

2015-08-02 Thread Quiles, Stephanie
hello again! I have to unify these methods so that i can enter an infix, convert it to a postfix and then solve. Here are the methods method #1 is : class Stack: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def push(self, item):

Re: [Tutor] email validation

2015-08-02 Thread Quiles, Stephanie
> On Aug 1, 2015, at 5:17 PM, Danny Yoo wrote: > Thank you, the program is now working but when the email is not entered > correctly it doesn’t make me go back and re-enter, it spits out an error code > but then moves on to the next field . Here is the code: import pickle def main():

Re: [Tutor] String Attribute

2015-08-02 Thread Ltc Hotspot
Hi Emile, I made a mistake and incorrectly assumed that differences between 54 lines of output and 27 lines of output is the result of removing duplicate email addresses, i.e., gsil...@umich.edu gsil...@umich.edu, c...@iupui.edu, c...@iupui.edu Apparently, this is not the case and I was wrong :(

Re: [Tutor] String Attribute

2015-08-02 Thread Ltc Hotspot
Hi Alan, I made a mistake and incorrectly assumed that differences between 54 lines of output and 27 lines of output is the result of removing duplicate email addresses, i.e., gsil...@umich.edu gsil...@umich.edu, c...@iupui.edu, c...@iupui.edu Apparently, this is not the case and I was wrong :(

Re: [Tutor] FETCH URLs FROM WEBSITE

2015-08-02 Thread Gaurav Lathwal
Thank you very much for your input. :) I did not that there was a such thing as websites raising flags on people downloading stuff this way. I will take care about it from next time onwards. & Both of you know a lot about all this, how do I go about doing that ? I mean, how do I learn that much ?