Pacote string
No Python temos o módulo string, que fornece como dados, os caracteres visíveis e invisíveis.
>>> import string>>> help(string)Help on module string:NAMEstring - A collection of string constants.MODULE REFERENCEhttps://docs.python.org/3.8/library/stringThe following documentation is automatically generated from the Pythonsource files. It may be incomplete, incorrect or include features thatare considered implementation detail and may vary between Pythonimplementations. When in doubt, consult the module reference at thelocation listed above.DESCRIPTIONPublic module variables:whitespace -- a string containing all ASCII whitespaceascii_lowercase -- a string containing all ASCII lowercase lettersascii_uppercase -- a string containing all ASCII uppercase lettersascii_letters -- a string containing all ASCII lettersdigits -- a string containing all ASCII decimal digitshexdigits -- a string containing all ASCII hexadecimal digitsoctdigits -- a string containing all ASCII octal digitspunctuation -- a string containing all ASCII punctuation charactersprintable -- a string containing all ASCII characters considered printableCLASSESbuiltins.objectFormatterTemplateclass Formatter(builtins.object)| Methods defined here:|..DATA__all__ = ['ascii_letters', 'ascii_lowercase', 'ascii_uppercase', 'cap...ascii_letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'digits = '0123456789'hexdigits = '0123456789abcdefABCDEF'octdigits = '01234567'printable = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU...punctuation = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'whitespace = ' \t\n\r\x0b\x0c'FILE/home/brito/.pyenv/versions/3.8.2/lib/python3.8/string.py
Veja como é fácil a utilização:
kjh
>>> import string >>> help(string) >>> string.ascii_letters 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' >>> string.ascii_lowercase 'abcdefghijklmnopqrstuvwxyz' >>> string.ascii_uppercase 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
Comentários