# ascii() function in Python

## Introduction

The `ascii()` function returns a string containing a printable representation of an object, escaping the non-ASCII characters in the string using `\x`, `\u`, or `\U` escapes.

The syntax of `ascii()` function looks like this:

```python
ascii(object)

```

where `object` can be String, List, Tuple, Dictionary, etc.

## Examples

```python
message = "I love iRead"
print(ascii(message))

```

Output:

```bash
'I love iRead'

```

With ASCII characters, the `ascii()` function doesn't make much difference.

```python
message = "I love îReâd"
print(ascii(message))

```

Output:

```bash
'I love \xeeRe\xe2d'

```

But when non-ASCII characters are added, the `ascii()` function escapes them using `\x`, `\u`, or `\U`. For example, `î`is replaced by`\xee`. and `â` is replaced by `\xe2`.

If you print the above output as below:

```python
print("I love \xeeRe\xe2d")

```

You will get this as output:

```bash
I love îReâd

```

which is obvious.

## Conclusion

In this part, we learned about the Python `ascii()` function with the help of examples.
