String Import in Python


Example


The string is one of the popular modules in python. We can deal with Uppercase Letters, Lowercase Letters, Numeric etc.


See the below Code........


Example 1:

>>> import string

>>> string.ascii_letters

'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'


Example 2:

>>> string.ascii_lowercase

'abcdefghijklmnopqrstuvwxyz'

>>> string.ascii_uppercase

'ABCDEFGHIJKLMNOPQRSTUVWXYZ'


Example 3:

>>> string.hexdigits

'0123456789abcdefABCDEF'

>>> string.digits

'0123456789'


# chr()  this function takes ascii code return symbol

Example 4:

>>> for i in range(40, 100):

print(chr(i))

(

)

*

+

,

-

.

/

0

1

2

3

4

5

6

7

8

9

:

;

<

=

>

?

@

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

[

\

]

^

_

`

a

b

c


Enjoy String Import Tutorial 😉


Get Help

Comments

Popular posts from this blog

How To Create .ENV File in Python

Create a Large file for Test Data Processing using Python

How to solve the Liner Equation using Python