Python - Quick Guide
How to setup python on your computer-
Python is free and open source, available for all operating systems from python.org. If not already installed, this article will help you with your python setup.
Download and Install Python
IPython is a interpreted language which means that the code is translated (interpreted) to binary code while the programs runs.
To run Python code you need to have a Python interpreter. There are different versions of python, either python 2 or python 3.
Python Variables
In python , variables are the storage placeholder for texts and numbers.
Using the Python interpreter
The Python interpreter is usually installed in /usr/local/bin/python on machines where it is available.
Python comments
When working with any programming language, you include comments in the code to notate your work.
This details what certain parts of the code are for, and lets other developers know what you were up to when you wrote the code.
Python Docstrings
Python documentation strings (or docstrings) provide a convenient way of associating documentation with python modules , functions , classes, and methods
Keywords in Python
Keywords in python are reserved words that cannot be used as ordinary identifiers. They must be spelled exactly as they are written.
Booleans in Python
Boolean values are the two constant objects False and True.
They are used to represent truth values (other values can also be considered false and true).
Operators
Python includes the +,-,*,/,% (modulus), and **(exponentiation) operators.
Regular Expressions in python
Regular Expressions are a string pattern written in a compact syntax, that allows us to quickly check whether a given string matches or contains a given pattern.
Using math in python
The python distribution includes the python interpreter , a very simple development environment, called IDLE, libraries, tools, and documentation.
Exception Handling in python
In this post we will cover how python handles errors with exceptions.
Strings in python
A string is a list of characters in orders.
Concatenate Strings
One common task you will need to accomplish with any language involves merging or combining strings. This process is referred to to as concatenation.
The best way to describe it is when you take two separate strings - stored by the interpreter - and merge them so that they become one.
Lists in python
The simplest data structure in python and is used to store a list of values.
Lists are collections of items (strings, integers, or even other lists).
Dictionaries in python
Dictionaries are collections of items that have a "key" and a "value".
Dictionary Manipulation in python
Methods of Dictionary objects
String Manipulation in python
Methods of String objects
List Manipulation in Python
Methods of List objects
Loops
To keep a computer doing useful work we need repetition , looping back over the same block of code again and again.
List Comprehensions in python
List comprehensions provide a concise way to create lists.
Functions
A function is something you can call (possible with some parameters, the things you put in the parentheses), which performs an action and returns a value.
Conditional statements in python
In programming , very often we want to check the conditions and change the behavior of the program.
IF..Elif..Else Statement
IF..Elif..Else Statement
Conditions tests if a something is True or False, and it uses Boolean values (type bool) to check that.
modules
Python modules make the programming a lot easier. It is basically a file that consist of already written code.
How to use Pillow, a fork of PIL
Pillow is a fork of PIL (python Image Library), started and maintained by Alex Clark and contributors. It was based on the PIL code, and then evolved to a better, modern and more friendly version of PIL. It adds support for opening, manipulating, and saving many different image file formats. A lot of things work the same way as the original PIL.
Reading and Writing Files in python
When you're working in python , you don't need to import a library in order to read and write files. It's handled natively in the language , albeit in a unique manner.
With Statement in python
In python you need to give access to a file by opening it. you can do it by using the open() function. Open returns a file object, which has methods and attributes for getting information about and manipulating the opened file.
Python Style Rules
This style guide is a list of dos and don'ts for python programs.
Python Language Rules
PEP8 has emerged as the style guide that most projects. It promotes a very readable and eye-pleasing coding style.
ipython
IPython is an interactive shell for the python programming language that offers enhanced introspection, additional shell syntax, tab completion and rich history.
Comments
Post a Comment