by Suf | Jun 20, 2022 | Programming, Python, Tips
In Python, you cannot access values inside a datetime.datetime object using indexing syntax. A datetime.datetime object represents a date (year, month and day) and time. We can solve this error by using the dot notation to access a specific attribute. For example,...
by Suf | Jun 19, 2022 | Programming, Python, Tips
In Python, you cannot access values inside a generator object using indexing syntax. A generator function returns a generator object, an iterator containing a sequence of values. We can access the values in a generator object using a for loop or by calling next(). We...
by Suf | Jun 19, 2022 | Programming, Python, Tips
In Python, you cannot access values inside a filter object using indexing syntax. A filter object is an iterator containing the items in the specified iterable that satisfy the condition of the function passed to the filter() function. We can solve the error by...
by Suf | Jun 19, 2022 | Programming, Python, Tips
In Python, you cannot access values inside a dict_items object using indexing syntax. A dict_items object is a view object that displays a list of a given dictionary’s key-value tuple pairs. You can solve this error by converting the dict_items object to a list...
by Suf | Jun 18, 2022 | Programming, Python, Tips
In Python, you cannot access values inside a zip object using indexing syntax. The zip() function takes iterables and aggregates them into a tuple. The resultant zip object is an iterator of tuples. You can solve this error by converting the zip object to a list...
by Suf | Jun 18, 2022 | Programming, Python, Tips
In Python, you cannot access values inside a _csv.reader object using indexing syntax. The reader() method from the csv module returns a _csv.reader object, which is an iterable containing the lines of the file. We can solve this error by converting the _csv.reader...