Re: How to check if any item from a list of strings is in a big string?

2009-07-16 Thread inkhorn
Hi all, This was more a question of programming aesthetics for me than one of great practical significance. I was looking to perform a certain function on files in a directory so long as those files weren't found in certain standard directories. In other words, I was using os.walk () to get mult

Re: How to check if any item from a list of strings is in a big string?

2009-07-10 Thread inkhorn
Thanks all!! I found the following to be most helpful: any(substr in long_string for substr in list_of_strings) This bang-for-your-buck is one of the many many reasons why I love Python programming :) Matt Dubins -- http://mail.python.org/mailman/listinfo/python-list

How to check if any item from a list of strings is in a big string?

2009-07-09 Thread inkhorn
Hi all, For one of my projects, I came across the need to check if one of many items from a list of strings could be found in a long string. I came up with a pretty quick helper function to check this, but I just want to find out if there's something a little more elegant than what I've cooked up

Re: tkSimpleDialog window focus problem

2009-02-05 Thread inkhorn
Frame.focus_force() method. Observe: self.userid = tkSimpleDialog.askstring("UTSCID Entry","UTSCID:") self.focus_force() Now, the next tkSimpleDialog.askstring call that I made ACTUALLY gets the keyboard focus automatically. Cheers, Matt On Feb 4, 10:21 am, inkhorn wrote: &

tkSimpleDialog window focus problem

2009-02-04 Thread inkhorn
Hi all, As part of the program I've created and am maintaining, the user has to type in his/her username and password into tkinter simple dialog windows. What you'll see below is that I've nested an askstring dialog window within a call to use the ftp module to login to an FTP server. result = s

Re: Membership of multiple items to a list

2009-02-01 Thread inkhorn
Wow thanks for the lightning fast reply! This does exactly the right job. Matt On Feb 1, 3:01 pm, Stephen Hansen wrote: > I'd like to know how to elegantly check a list for the membership of > any of its items to another list.  Not caring for elegance, I would > use the following code: > That's

Membership of multiple items to a list

2009-02-01 Thread inkhorn
Dear all, I'd like to know how to elegantly check a list for the membership of any of its items to another list. Not caring for elegance, I would use the following code: blah = [1,2,3] yadda = [3,4,5,6] blah[0] or blah[1] or blah[2] in yadda Please tell me how to change the preceding code into