EP2: comentários

Re: EP2: comentários

by José Coelho de Pina -
Number of replies: 0

Como ficaria o caso de textos com letras acentuadas?

 LETRAS = 'aáàbcdeífghiéjklmnoópqrstuúvwxyzAÀÁBCDEÉFGHIÍJKLMNOÓPQRSTUÚVWXYZ'


Python 3.4.3 (default, Mar 26 2015, 22:03:40) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> str = "a"
>>> str.isalpha()
True
>>> "a".isalpha()
True
>>> "e".isalpha()
True
>>> str = "1"
>>> str.isalpha()
False
>>> s = "*"
>>> s.isalpha()
False
>>> s = "oi"
>>> s.isalpha()
True
>>> s = "oi1"
>>> s.isalpha()
False
>>> "é".isalpha()
True
>>> "à".isalpha()
True
>>> "também".isalpha()
True
>>> "também,".isalpha()
False
>>> help(str.isalpha)

Help on built-in function isalpha:

isalpha(...) method of builtins.str instance
    S.isalpha() -> bool
    
    Return True if all characters in S are alphabetic
    and there is at least one character in S, False otherwise.

>>>