Skip to content
Home » Typeerror: ‘int’ object is not subscriptable – Python

Typeerror: ‘int’ object is not subscriptable – Python

To solve Error: ‘int’ object is not subscriptable – Python error follow below methods. Some Python objects can be subscripted. This means that they contain, or have the potential to contain, other items. Integers aren’t a subscriptable type of object. They’re used to keep track of full numbers. An error will be triggered if you treat an integer like a subscriptable object.

ERROR LOG

typeerror: 'int' object is not subscriptable

How to solve Error: ‘int’ object is not subscriptable – Python ?

Refer the given methods to solve the issue.

We may solve this problem by removing the int() statement from our code. The string value returned by the input() operation. Using our code, we can cut up this string value.

holiday = input("enter a date : (mmddyyyy) ")

Our code works perfectly! We are no longer attempting to slice an integer because our code lacks an int() statement. Instead, the word “holiday” is saved as a string. The slicing syntax is used to slice this string.

Hope the above solution works.

Also read :

Error: Node Sass version 5.0.0 is incompatible with ^4.0.0.
ImportError: No module named pythoncom