Purpose of “%matplotlib inline”

%matplotlib is a magic function in IPython. I’ll quote the relevant documentation here for you to read for convenience: IPython has a set of predefined ‘magic functions’ that you can call with a command line style syntax. There are two kinds of magics, line-oriented and cell-oriented. Line magics are prefixed with the % character and work much like … Read more

SyntaxError: “can’t assign to function call”

Syntactically, this line makes no sense: You are attempting to assign a value to a function call, as the error says. What are you trying to accomplish? If you’re trying set subsequent_amount to the value of the function call, switch the order:

Relative imports in Python 3

unfortunately, this module needs to be inside the package, and it also needs to be runnable as a script, sometimes. Any idea how I could achieve that? It’s quite common to have a layout like this… …with a mymodule.py like this… …a myothermodule.py like this… …and a main.py like this… …which works fine when you run main.py or mypackage/mymodule.py, but fails with mypackage/myothermodule.py, due to … Read more

Python Variable Declaration

Okay, first things first. There is no such thing as “variable declaration” or “variable initialization” in Python. There is simply what we call “assignment”, but should probably just call “naming”. Assignment means “this name on the left-hand side now refers to the result of evaluating the right-hand side, regardless of what it referred to before … Read more

How do I install opencv using pip?

I need to install cv2 for a script that has been written for me. I tried pip install cv2 and pip install open_cv and got the same problem – a warning message from dist.py and complains about zlib being not found. No cv2 installed. I also tried pyopenvc and pip install opencv-python. So, I went … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)