Character to ASCII and vice versa

Converting between Characters and ASCII

When manipulating strings it may be required to convert to an ASCII character or to a character from an ASCII value. Python has two predefined functions to achieve this.

For example

Will produce:

97

For example

Will produce:

A

You can use this to generate random characters using ASCII codes. A sample ASCII table is linked here

So we can use this to generate a random value between 65 and 90 and then grab the corresponding ASCII value to generate a random uppercase character such as below. This could be a useful technique for generating passwords etc.

Tutorial Video - String Handling 

7 - String Handling.mp4