Python: Erklärungen und Tutorials

Sequence Types — list, tuple, range

Data Structures – List – Functional Programming Tools
There are three built-in functions that are very useful when used with lists: filter(), map(), and reduce().

Python: List Comprehensions
Listen-Abstraktion (List Comprehension)

How to quit the Python prompt

To exit the prompt, press Ctrl-d if you are using IDLE or are using a Linux/BSD shell. In case of the Windows command prompt, press Ctrl-z followed by Enter.

shebang line

Python does not use comments except for the special case of the first line here. It is called the shebang line – whenever the first two characters of the source file are #! followed by the location of a program, this tells your Linux/Unix system that this program should be run with this interpreter when you execute the program.

#!/usr/bin/env python

How to execute Python scripts(.py) in Linux
run a python script in terminal without the python command

String Note for Regular Expression Users

Always use raw strings when dealing with regular expressions. Otherwise, a lot of backwhacking may be required. For example, backreferences can be referred to as ‘\\1′ or r’\1’.

Variables: Identifier Naming

Objects

Remember, Python refers to anything used in a program as an object. This is meant in the generic sense. Instead of saying ‘the something’, we say ‘the object’.
Python is strongly object-oriented in the sense that everything is an object including numbers, strings and even functions.

Indentation

Whitespace is important in Python. Actually, whitespace at the beginning of the line is important. This is called indentation. Leading whitespace (spaces and tabs) at the beginning of the logical line is used to determine the indentation level of the logical line, which in turn is used to determine the grouping of statements.
This means that statements which go together must have the same indentation. Each such set of statements is called a block. We will see examples of how blocks are important in later chapters.

Web Application Framework

Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions. And before you ask: It’s BSD licensed!
Flask (A Python Microframework)
Wikipedia: Flask
Adding Flask support to an existing Pycharm project

Links

What does `if __name__ == “__main__”:` do?
A module’s __name__
python-kurs.eu: Objektorientierte Programmierung (OOP)
Galileo <openbook>: Objektorientierung

Leave a Reply

Your email address will not be published. Required fields are marked *