What is setup.py?

setup.py is a python file, the presence of which is an indication that the module/package you are about to install has likely been packaged and distributed with Distutils, which is the standard for distributing Python Modules. This allows you to easily install Python packages. Often it’s enough to write: pip will use setup.py to install … Read more

TypeError: list indices must be integers or slices, not list

This is a classic mistake. i in your case is already an element from array (i.e. another list), not an index of array (not an int), so You can check the Python tutorial. Also, try doing this: And see what you get! Also I would advise to stick to naming conventions: variables are normally lower-case (volume, not Volume). In this case i is misleading. row or elem would be much more suitable.

Pip freeze vs. pip list

When you are using a virtualenv, you can specify a requirements.txt file to install all the dependencies. A typical usage: The packages need to be in a specific format for pip to understand, which is That is the “requirements format”. Here, django==1.4.2 implies install django version 1.4.2 (even though the latest is 1.6.x). If you … Read more

working of \n in python [duplicate]

There are two functions that give an object’s string representation, repr() and str(). The former is designed to convert the object to as-code string, while the latter gives user-friendly string. When you input the variable name in the command line, repr() is used, and \n character is shown as \n (as-code). When you use print, … Read more

Relative imports in Python 3

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 the relative import… The way you’re supposed to run it is… …but it’s somewhat verbose, and doesn’t mix well with a shebang line like #!/usr/bin/env python3. The simplest … Read more

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