python学习--string模块

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/z919167107/article/details/52224325

**使用之前:

import string;

可方便使用模块内的纯字母(包含大小写),纯小写字母,纯大写字母,纯数字,16进制数字,全部纯标点符号,全部字母符号**


The constants defined in this module are:

string.ascii_letters

The concatenation of the ascii_lowercase and ascii_uppercase constants described below. This value is not locale-dependent.

string.ascii_lowercase

The lowercase letters ‘abcdefghijklmnopqrstuvwxyz’. This value is not locale-dependent and will not change.

string.ascii_uppercase

The uppercase letters ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’. This value is not locale-dependent and will not change.

string.digits

The string ‘0123456789’.

string.hexdigits

The string ‘0123456789abcdefABCDEF’.

string.letters

The concatenation of the strings lowercase and uppercase described below. The specific value is locale-dependent, and will be updated when locale.setlocale() is called.

string.lowercase

A string containing all the characters that are considered lowercase letters. On most systems this is the string ‘abcdefghijklmnopqrstuvwxyz’. The specific value is locale-dependent, and will be updated when locale.setlocale() is called.

扫描二维码关注公众号,回复: 6196589 查看本文章

string.octdigits

The string ‘01234567’.

string.punctuation

String of ASCII characters which are considered punctuation characters in the C locale.

string.printable

String of characters which are considered printable. This is a combination of digits, letters, punctuation, and whitespace.

string.uppercase

A string containing all the characters that are considered uppercase letters. On most systems this is the string ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’. The specific value is locale-dependent, and will be updated when locale.setlocale() is called.

string.whitespace

A string containing all characters that are considered whitespace. On most systems this includes the characters space, tab, linefeed, return, formfeed, and vertical tab.

当然了,也可以用chr(asci)、ord(字母)

任何关于python的问题都可以相互交流,欢迎打扰

猜你喜欢

转载自blog.csdn.net/z919167107/article/details/52224325