ImportError: No module named ‘MySQL’

I was facing the similar issue. My env details – Python 2.7.11 pip 9.0.1 CentOS release 5.11 (Final) Error on python interpreter – Use pip to search the available module – Install the mysql-connector-python-rf – Verify Thanks =) For python3 and later use the next command: $ pip3 install mysql-connector-python-rf

range() for floats

As the comments mention, this could produce unpredictable results like: To get the expected result, you can use one of the other answers in this question, or as @Tadhg mentioned, you can use decimal.Decimal as the jump argument. Make sure to initialize it with a string rather than a float. Or even: And then: [editor’s not: if you only … Read more

How to set environment variables in PyCharm?

You can set environmental variables in Pycharm’s run configurations menu. Open the Run Configuration selector in the top-right and cick Edit Configurations… Find Environmental variables and click … Add or change variables, then click OK You can access your environmental variables with os.environ

How to add a new row to an empty numpy array

The way to “start” the array that you want is: Which is an empty array but it has the proper dimensionality. Then be sure to append along axis 0: But, @jonrsharpe is right. In fact, if you’re going to be appending in a loop, it would be much faster to append to a list as … Read more

How to print Unicode character in Python?

To include Unicode characters in your Python source code, you can use Unicode escape characters in the form \u0123 in your string. In Python 2.x, you also need to prefix the string literal with ‘u’. Here’s an example running in the Python 2.x interactive console: In Python 2, prefixing a string with ‘u’ declares them as Unicode-type variables, as … Read more