by Suf | Jul 15, 2022 | Programming, Python, Tips
This error occurs when you pass the encoding keyword argument to an open() function call while reading or writing to a file in binary mode. The encoding keyword argument is only suitable for reading or writing in text mode. If you are accessing a file in binary mode...
by Suf | Jul 14, 2022 | Programming, Python, Tips
This error occurs when you try to update a dictionary with incorrect syntax. You can solve this error by updating the dictionary with another dictionary or an iterable object containing key-value pairs. For example, my_dict = {‘name’:’Tia’,...
by Suf | Jul 13, 2022 | Programming, Python, Tips
This error occurs when you try to access a Response object using the subscript operator [], without first parsing the object to a subscriptable Python object. You can solve this error by converting the Response object into a subscriptable Python object. For example,...
by Suf | Jul 13, 2022 | Programming, Python, Tips
If you put parentheses after a generator object, Python interprets this as a call. As only functions are callable, the Python interpreter will raise the TypeError: ‘generator’ object is not callable. This error typically occurs when overriding a function...
by Suf | Jul 13, 2022 | Programming, R, Tips
This error occurs when you try to create a data frame with vectors with different lengths. The resultant data frame would have a differing number of rows in each column. You can solve the error by checking the lengths of the vectors and filling the shorter vectors...
by Suf | Jul 12, 2022 | Programming, Python, Tips
If you pass an empty string to the str.split() method, you will raise the ValueError: empty separator. If you want to split a string into characters you can use list comprehension or typecast the string to a list using list(). def split_str(word): return [ch for ch in...