``````

In [1]:

i = 100

``````
``````

In [2]:

s_i = str(i)
print(s_i)

``````
``````

100

``````
``````

In [3]:

print(type(s_i))

``````
``````

<class 'str'>

``````
``````

In [4]:

f = 0.123

``````
``````

In [5]:

s_f = str(f)
print(s_f)

``````
``````

0.123

``````
``````

In [6]:

print(type(s_f))

``````
``````

<class 'str'>

``````
``````

In [7]:

i = 0xFF
print(i)

``````
``````

255

``````
``````

In [8]:

s_i = str(i)
print(s_i)

``````
``````

255

``````
``````

In [9]:

f = 1.23e+10
print(f)

``````
``````

12300000000.0

``````
``````

In [10]:

s_f = str(f)
print(s_f)

``````
``````

12300000000.0

``````
``````

In [11]:

s_i_format = format(i, '#X')
print(s_i_format)

``````
``````

0XFF

``````
``````

In [12]:

s_f_format = format(f, '.2e')
print(s_f_format)

``````
``````

1.23e+10

``````
``````

In [13]:

l = [0, 1, 2]

``````
``````

In [14]:

s_l = str(l)
print(s_l)

``````
``````

[0, 1, 2]

``````
``````

In [15]:

print(type(s_l))

``````
``````

<class 'str'>

``````
``````

In [16]:

d = {'a': 1,
'b': 2,
'c': 3}

``````
``````

In [17]:

s_d = str(d)

``````
``````

In [18]:

print(s_d)

``````
``````

{'a': 1, 'b': 2, 'c': 3}

``````
``````

In [19]:

print(type(s_d))

``````
``````

<class 'str'>

``````
``````

In [20]:

import pprint

``````
``````

In [21]:

dl = {'a': 1, 'b': 2, 'c': [100, 200, 300]}

``````
``````

In [22]:

s_dl = str(dl)
print(s_dl)

``````
``````

{'a': 1, 'b': 2, 'c': [100, 200, 300]}

``````
``````

In [23]:

p_dl = pprint.pformat(dl, width=10)
print(p_dl)

``````
``````

{'a': 1,
'b': 2,
'c': [100,
200,
300]}

``````
``````

In [24]:

print(type(p_dl))

``````
``````

<class 'str'>

``````