Python String Module

Python String Module consists of several useful constants, classes and functions. These functions are used to manipulate the strings.

Example:

1. string.ascii_letters: Combination of ascii_lowercase and ascii_uppercase constants.

2. string.ascii_lowercase: It refers to all lowercase letters from a-z.

3. string.ascii_uppercase: It refers to all uppercase letters from A-Z.

4. string.digits: It refers to digits from 0-9.

5. string.hexdigits: It refers to hexadecimal digits 0-9, a-f, and A-F.

6. string.lowercase: A string that has all the characters that are considered lowercase letters.

7. string.uppercase: A string that has all the characters that are considered uppercase letters.

8. string.punctuation: A string of printable characters which includes digits, letters, punctuation, and whitespace.

9. string.octdigits: It refers to octal digits, 0-7.

10. string.whitespace: A string that has all characters that are considered whitespace like space, tab, linefeed, return, form-feed and vertical tab.

Example:

Output:
Uppercase= WELCOME TO WEBEDUCLICK
Lowercase= welcome to webeduclick
Split= [‘Welcome’, ‘to’, ‘Webeduclick’]
Join= w_e_l_c_o_m_e_ _t_o_ _w_e_b_e_d_u_c_l_i_c_k
Replace= Welcome to W3School
Count of e= 4
Find to= 8