On Sat, Jul 12, 2014 at 02:39:12PM +0200, Wolfgang Maier wrote:
[...]
> Very interesting advice. Wasn't aware at all of this feature of casefold.
> As a native German speaker, I have to say that your last two examples
> involving the capital ß are pretty contrived: although the capital ß is
> par
On 12/07/14 13:19, Steven D'Aprano wrote:
Because the person might have typed any of:
grosse
große
etc., and you want to accept them all, just like in English
The bit I was missing was that a German user might use the ss version
instead the ß so testing for either of them alone is insuffi
On 12.07.2014 14:20, Dave Angel wrote:
I don't remember my high school German enough to remember if the ß
character is an example, but in various languages there are
characters that exist only in uppercase, and whose lowercase
equivalent is multiple letters. Or vice versa. And characters
On 12.07.2014 14:19, Steven D'Aprano wrote:
On Sat, Jul 12, 2014 at 11:27:17AM +0100, Alan Gauld wrote:
On 12/07/14 10:28, Steven D'Aprano wrote:
If you're using Python 3.3 or higher, it is better to use
message.casefold rather than lower. For English, there's no real
difference:
...
but it ca
Thank you guys! Works perfectly! :D
Regards,
Steve Rodriguez
On Sat, Jul 12, 2014 at 1:21 AM, Peter Otten <__pete...@web.de> wrote:
> Peter Otten wrote:
>
> > PS: You sometimes see
> >
> > message in "qQ"
> >
> > but this is buggy as it is true when the message is either
> > "q", "Q", or "qQ".
Hi Steve,
In your conditionals:
…
while message != 'q' or 'Q'/message != “q” or message != “Q”:
…
Python will only match the first variable. A better approach (which might be a
good solution) would be capturing the exit commands in a list like this:
JL’s code:
while message not in [“q”, “Q”]
Steven D'Aprano Wrote in message:
> On Sat, Jul 12, 2014 at 09:33:20AM +0100, Alan Gauld wrote:
>
>> 2) Better (IMHO) is to convert message to lower case (or upper if
>> you prefer) and only do one comparison:
>>
>> while message.lower() != 'q':
>
> I second this advice, but with a slight modif
On Sat, Jul 12, 2014 at 11:27:17AM +0100, Alan Gauld wrote:
> On 12/07/14 10:28, Steven D'Aprano wrote:
>
> >If you're using Python 3.3 or higher, it is better to use
> >message.casefold rather than lower. For English, there's no real
> >difference:
> >...
> >but it can make a difference for non-E
On 12/07/14 10:28, Steven D'Aprano wrote:
If you're using Python 3.3 or higher, it is better to use
message.casefold rather than lower. For English, there's no real
difference:
...
but it can make a difference for non-English languages:
py> "Große".lower() # German for "great" or "large"
'groß
On Sat, Jul 12, 2014 at 09:33:20AM +0100, Alan Gauld wrote:
> 2) Better (IMHO) is to convert message to lower case (or upper if
> you prefer) and only do one comparison:
>
> while message.lower() != 'q':
I second this advice, but with a slight modification.
If you're using Python 3.3 or higher,
On 11/07/14 22:16, Steve Rodriguez wrote:
Hey guys n gals,
New to python, having some problems with while loops, I would like to
make a program quick once q or Q is typed, but thus far I can only get
the first variable to be recognized.
> My code looks like:
>
> message = raw_input("-> ")
Peter Otten wrote:
> PS: You sometimes see
>
> message in "qQ"
>
> but this is buggy as it is true when the message is either
> "q", "Q", or "qQ".
Oops, I forgot "".
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription option
Steve Rodriguez wrote:
> Hey guys n gals,
>
> New to python, having some problems with while loops, I would like to make
> a program quick once q or Q is typed, but thus far I can only get the
> first variable to be recognized. My code looks like:
>
> message = raw_input("-> ")
> while m
Hey guys n gals,
New to python, having some problems with while loops, I would like to make
a program quick once q or Q is typed, but thus far I can only get the first
variable to be recognized. My code looks like:
message = raw_input("-> ")
while message != 'q':
s.send(message)
14 matches
Mail list logo