Your indentation is goofed, and you’ve mixed tabs and spaces. Run the script with python -tt
to verify.
Related Posts:
- Why do I get AttributeError: ‘NoneType’ object has no attribute ‘something’?
- AttributeError(“‘str’ object has no attribute ‘read'”)
- Why Python 3.6.1 throws AttributeError: module ‘enum’ has no attribute ‘IntFlag’?
- AttributeError(“‘str’ object has no attribute ‘read'”)
- AttributeError: ‘module’ object has no attribute
- Timeout on a function call
- AttributeError: ‘Tensor’ object has no attribute ‘_keras_history’
- AttributeError: ‘Series’ object has no attribute ‘reshape’
- pip3 error – ‘_NamespacePath’ object has no attribute ‘sort’
- Check if a given key already exists in a dictionary
- ValueError: setting an array element with a sequence
- ‘python’ is not recognized as an internal or external command [duplicate]
- Find the current directory and file’s directory [duplicate]
- Finding the index of an item in a list
- How can I randomly select an item from a list?
- Python Error: AttributeError: __enter__ [duplicate]
- How to plot a histogram using Matplotlib in Python with a list of data?
- Convert pandas dataframe to NumPy array
- Fastest way to check if a value exists in a list
- TypeError: can’t multiply sequence by non-int of type ‘str’
- Error:cannot convert float NaN to integer in pandas
- What does the % sign mean in coding?
- Replacing column values in a pandas DataFrame
- How can I count the occurrences of a list item?
- Unable to plot Double Bar, Bar plot using pyplot for ndarray
- matplotlib error – no module named tkinter
- AttributeError: module ‘urllib3’ has no attribute ‘urlopen’ in python
- How to download a file over HTTP?
- filedialog, tkinter and opening files
- How do I get the row count of a Pandas DataFrame?
- Singular matrix issue with Numpy
- Get unique values from a list in python
- ‘list’ object has no attribute ‘shape’
- What does the ‘b’ character do in front of a string literal?
- How to add multiple values per key in python dictionary
- Pythonic way to combine FOR loop and IF statement
- Python: OverflowError: math range error
- Best way to replace multiple characters in a string?
- Convert base-2 binary number string to int
- setup script exited with error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1
- sublime text2 python error message /usr/bin/python: can’t find ‘__main__’ module in ”
- load csv into 2D matrix with numpy for plotting
- Python TypeError: cannot convert the series to
when trying to do math on dataframe - How do I do a case-insensitive string comparison?
- How to fix ‘ValueError: list.remove(x): x not in list’ error in Python
- How can I convert radians to degrees with Python?
- How to initialize a two-dimensional array in Python?
- How to configure logging to syslog in Python?
- Converting binary to decimal integer output
- Don’t understand this SyntaxError: illegal target for annotation
- No module named setuptools
- Using Queue in python
- Whats the difference between ‘for x in list:’ and ‘for x in list[:]:’
- Python: maximum recursion depth exceeded while calling a Python object
- Checking if a number is prime in Python
- Implementing an efficient queue in Python
- Modify the legend of pandas bar plot
- Python int to binary string?
- Full examples of using pySerial package
- Checking whether a variable is an integer or not
- Using headers with the Python requests library’s get method
- Pandas DataFrame: replace all values in a column, based on condition
- How to create a trie in Python
- How to convert string to datetime format in pandas python?
- TypeError: expected a character buffer object
- “RuntimeError: Make sure the Graphviz executables are on your system’s path” after installing Graphviz 2.38
- Convert date to datetime in Python
- UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xa0′ in position 20: ordinal not in range(128)
- How to install PyQt5 on Windows?
- How do I get the day of week given a date?
- TypeError: ‘dict_keys’ object does not support indexing
- Add Variables to Tuple
- Python: Converting string into decimal number
- Segmentation fault: 11 in OS X
- Removing duplicates from a list of lists
- plotly: TypeError: cannot convert dictionary update sequence element #0 to a sequence
- Update python dictionary (add another value to existing key)
- scrapy run spider from script
- Using replace() method in python by index
- Python, how to handle the “ValueError: unsupported pickle protocol: 4” error?
- python error: TypeError: an integer is required
- Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
- Get an attribute value based on the name attribute with BeautifulSoup
- Plot a histogram such that the total area of the histogram equals 1
- pip throws TypeError: parse() got an unexpected keyword argument ‘transport_encoding’ when trying to install new packages
- How to change legend size with matplotlib.pyplot
- An equivalent function to matplotlib.mlab.bivariate_normal
- MovieWriter ffmpeg unavailable; trying to use class ‘matplotlib.animation.PillowWriter’ instead
- How can I access global variable inside class in Python
- Sorting arrays in NumPy by column
- How to open html file?
- In Python, is there an elegant way to print a list in a custom format without explicit looping?
- “Python version 2.7 required, which was not found in the registry” error when attempting to install netCDF4 on Windows 8
- Does tkinter have a table widget?
- Releasing memory in Python
- Text progress bar in terminal with block characters
- Extracting specific selected columns to new DataFrame as a copy
- How to read a CSV file from a URL with Python?
- How to print both strings in a dictionary in Python
- Python: OSError: [Errno 2] No such file or directory: ”