int object is not subscriptable in python

Solutions on MaxInterview for int object is not subscriptable in python by the best coders in the world

showing results for - "int object is not subscriptable in python"
Emmanuel
21 Jun 2016
1"""
2This error means the variable you want to subscript is an integer.
3
4if you want to subscript an int, a way of doing that is turning it to str.
5"""
6num = 1234
7x = num[2]  # does not work
8x = int(str(num)[2])  # works, x = 3