Re: [Tutor] Python Homework

2016-05-02 Thread Danny Yoo
On Sun, May 1, 2016 at 1:47 AM, Ben Finney wrote: > Katie Tuite writes: > > You'll need to write only plain text email (no attached documents, no > “rich text”) for the information to survive correctly. This is always > good practice for any technical discussion forum. Hi Katie, Also, try to pr

Re: [Tutor] simple regex question

2016-05-02 Thread Danny Yoo
On Sun, May 1, 2016 at 9:49 AM, bruce wrote: > I've created a test regex. However, after spending time/google.. can't > quite figure out how to then get the "complete" line containing the > returned regex/pattern. > > Pretty sure this is simple, and i'm just missing something. A few people have

Re: [Tutor] Dictionary Question

2016-05-02 Thread cs
On 03May2016 00:56, Jason N. wrote: Thank you all for your responses.  A quick follow up, what is the best way to make dictionary requests case in-sensitive? For example, "Apple and "apple" should bring back the same dictionary response. Thank you. There are a few ways depending what your mo

Re: [Tutor] Dictionary Question

2016-05-02 Thread isaac tetteh
If only I understand what you mean. You can just make all the values in the dictionary lower, upper or capitalized. Then if you want take an input or whatever you want to do with it just use .lower() or .upper() or .capitalized() to convert it to what is in the dictionary. Maybe someone has a be

Re: [Tutor] Dictionary Question

2016-05-02 Thread Jason N. via Tutor
Thank you all for your responses.  A quick follow up, what is the best way to make dictionary requests case in-sensitive? For example, "Apple and "apple" should bring back the same dictionary response. Thank you. On Monday, May 2, 2016 6:57 PM, Bob Gailer wrote: On May 2, 2016 5:27

Re: [Tutor] Dictionary Question

2016-05-02 Thread Bob Gailer
On May 2, 2016 5:27 PM, "Jason N. via Tutor" wrote: > > Hello, > Wanted to ask if its possible to have a dictionary that can be looked up by either values? > For example, > mydic = {"A: "Apple", "B": "Banana"}When user inputs "A" I want "Apple" to come. But if the user enter "Apple" I want "A" to

Re: [Tutor] Dictionary Question

2016-05-02 Thread Alan Gauld via Tutor
On 02/05/16 22:55, isaac tetteh wrote: > > For some reason i cant find reply all . But try this > for key, value in mydic.items(): > If A==value: >Print key or as a function: def findKey(dct, val): for k,v in dct.items(): if v == val: return k mydic = {"A: "

Re: [Tutor] Detect the folder of a file

2016-05-02 Thread Kanika Murarka
Thank you everyone ! My situation was to check the indentation of every python file via a script. I think looking for bin/activate will work. On 28 April 2016 at 23:08, Alan Gauld via Tutor wrote: > On 28/04/16 11:11, Steven D'Aprano wrote: > > > You know, some day I must learn why people use v

Re: [Tutor] Dictionary Question

2016-05-02 Thread isaac tetteh
Sorry for the if statement the correct statement should be "if 'apple' ==value:" Sent from my iPhone > On May 2, 2016, at 4:58 PM, isaac tetteh wrote: > > > For some reason i cant find reply all . But try this > for key, value in mydic.items(): > If A==value: > Print key > Nb:

Re: [Tutor] Dictionary Question

2016-05-02 Thread isaac tetteh
For some reason i cant find reply all . But try this for key, value in mydic.items(): If A==value: Print key Nb: use iteritems() if using python2 Sent from my iPhone > On May 2, 2016, at 4:29 PM, Jason N. via Tutor wrote: > > Hello, > Wanted to ask if its possible to have a d

[Tutor] Dictionary Question

2016-05-02 Thread Jason N. via Tutor
Hello, Wanted to ask if its possible to have a dictionary that can be looked up by either values? For example,  mydic = {"A: "Apple", "B": "Banana"}When user inputs "A" I want "Apple" to come. But if the user enter "Apple" I want "A" to respond. Please let me know the best way to handle this type