Guilherme Polo [EMAIL PROTECTED] wrote:
Let me post another one, and longer:
if ord(somechar) in range(ord('A'), ord('Z') + 1) + range(ord('a'),
ord('z') + 1):
...
That is very inefficient! Every time it is run it creates two lists
then joins them then throws the whole lot away!
if char in ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz:
cant i write something like:
if char in [A-Za-z]:
?
--
http://mail.python.org/mailman/listinfo/python-list
cirfu wrote:
if char in ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz:
cant i write something like:
if char in [A-Za-z]:
Either of the following should do what you want, without resorting to
regular expressions:
import string
if char in string.letters:
or
if char.isalpha():
--
On 24 juin, 20:32, cirfu [EMAIL PROTECTED] wrote:
if char in ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz:
cant i write something like:
if char in [A-Za-z]:
Nope. But there are other solutions. Here are two:
# 1
import string
if char in string.letters:
print yay
# 2
import re
On Tue, Jun 24, 2008 at 3:47 PM, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
On 24 juin, 20:32, cirfu [EMAIL PROTECTED] wrote:
if char in ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz:
cant i write something like:
if char in [A-Za-z]:
Nope. But there are other solutions. Here are
another way:
import string
if char in string.ascii_letters:
print('hello buddy!')
[]'s
- Walter
--
http://mail.python.org/mailman/listinfo/python-list
On Jun 24, 7:59 pm, Guilherme Polo [EMAIL PROTECTED] wrote:
On Tue, Jun 24, 2008 at 3:47 PM, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
On 24 juin, 20:32, cirfu [EMAIL PROTECTED] wrote:
if char in ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz:
cant i write something like:
if
On Jun 25, 4:32 am, cirfu [EMAIL PROTECTED] wrote:
if char in ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz:
cant i write something like:
if char in [A-Za-z]:
You can write that if you want to, but it's equivalent to
if char in zaZa]-[:
i.e. it doesn't do what you want.
This gives
On Jun 24, 5:36 pm, John Machin [EMAIL PROTECTED] wrote:
On Jun 25, 4:32 am, cirfu [EMAIL PROTECTED] wrote:
if char in ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz:
cant i write something like:
if char in [A-Za-z]:
You can write that if you want to, but it's equivalent to
if
On Jun 25, 9:06 am, [EMAIL PROTECTED] wrote:
On Jun 24, 5:36 pm, John Machin [EMAIL PROTECTED] wrote:
On Jun 25, 4:32 am, cirfu [EMAIL PROTECTED] wrote:
if char in ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz:
cant i write something like:
if char in [A-Za-z]:
You can
10 matches
Mail list logo