Science with Computer & Internet

Uni Tuebingen

Content courses




day 1
1. Introduction
2. Strings
3. Files

day 2
4. Lists,Loops
5. Functions

day 3
6. If-statement
7. Reg.Exp.

day 4
8. Dictionaries
9. System/Input

day 5 (Expert)




Python for biologists - In 4 days
and one expert day

German Version

This tutorial is dedicated to Dr. Martin Jones. His ideas inspired me and
I have borrowed many examples from his book.

This site is specially made for my students and I encourage everyone to buy his wonderful book.

Thanks to Aman Padamsey for the translation into English and Angela Gürtel for the final touches.

Introductory example ,
for example row 1 and column 12 
The data was generated by a plate reader.

Next courses

21.2. - 25.2.2022
Online 9:00 - 16:00

19.9. - 23.9.2022
9:00 - 16:00
Raum 152 (früher 168), Morgenstelle 3


9:00 - 16:00
Online MS Teams

max. 12 Teilnehmer
Alma Uni-Tuebingen

Day 1 - Introduction

Do biologists have to learn how to write a software?

  • No!

Programming is not part of the basic training for biologists. 
However in some areas programming is very helpful and even essential.

  • Bioinformatics is gaining momentum...

The scientific work in biology includes the identification and analysis of data. 
Specialized programs help with this ( overview Molecular Biology Programs ). 
Often a "bioinformatician" is asked for advice. When the basics of programming have been learned, This will be leading to greater understanding and overcoming of problems. 
The communication with the computer scientists is improving. 

Many programs are structured similarly, 
if one knows one, one can easily learn another.

  • Small programs can be written yourself .

With free programs like Python, R and Perl, simple solutions to difficult problems can be found.

  • Programming is a creative and fun process!

Rather than using rigid pre-designed software, you can let your imagination take control and create your very own!
No more of the 'one size fits all' when it comes to software!

Beginner programming languages ​​for biologists

There are a variety of programming languages 
list of programming languages

Which programming languages ​​are suitable for biologists?

  • Excel Course Excel
    The success and popularity of Excel is that you do not have to know any programming language. 
    More complex problems are handled with Excel Macros and VBA Course Excel .

  • MatLab
    Not free: belongs to Math Works
    Data Analysis, Plots 
    Free for students from Tübingen ( Campus Uni Tübingen Software ) 
    Courses WS 17/18

  • R
    Open source program.
    Scripting languages . For statistics, microarray, image analysis microscopy and data science

  • Python and Perl
    Scripting languages .
    Steep learning curve

  • PHP, web programming 
    Scripting languages . Courses ZDV

  • Java , same program use on different platforms (Windows, MacOSX, Linux) possible. 
    Development dependents on a company (Oracle). 

  • C, C++, C#
    Efficient programming language. User Interface. Very complex.

The other high-level programming languages ​​such as C ++ etc. are rarely learned and used by biologists.
Flat learning curve.

Why Python and not Perl?

Amino acid sequences of proteins and sequences of the DNA are perfect for programming procedures..

The scripting language Perl is and has been heavily used ( human genome project: How Perl Saved the Human Genome Project ). 
Perl was very successful and widespread. 
Why are we now considering Python instead?

Perl actually has a clear structure, but produces complex and incomprehensible code. 
Perl is therefore accused of poor readability ( Wikipedia ).

Perl allows a lot of freedom and is therefore less consistent. 
Perl is something of a controversy.
Although some people still love Perl (Perl poetry), a lot of people hate it Perl Most Disliked Programming Language 2017 ).

Python prefers clear solutions. 
Main principle is
There should be one - and preferably only one - obvious way to do it. "

Python offers better readability, and hence has become more popular - especially with beginners ( Wikipedia ). 
"Python is the most widely used entry-level programming language at top universities in the US", Heise Online 8.7.14
Python is now 3rd in the programming language ranking 2019 -
Python is the "most wanted" programming language - Heise online 13.10.17

A more serious competition to Python is R.
R is like Python: a scripting language and easy to learn.
According to the opinion of many, Python can be used more extensively.
R focuses on statistics and data analysis.
Here the powerful packages Numpy and pandas are available for Python.

Python, indents make Python clear
Python has a clear structure, 
indentations make Python clear - Photo Python Software Foundation -
GNU General Public License. Wikimedia Commons

Features of Python

  • Simple and clear

Python is simple and clear with as few keywords as possible and offers a clear syntax . 
Readability is the first point to create good code. It is often said that a code is only written once but is read very often.

How is this achieved?

- Clarity due to indentations (PEP8)

- A principle of Python is that there should be an obvious way to solve a problem. And unique code is preferred.
(PEP20 Zen of Python , import this - The story of ZEN of Python 
"Beautiful is better than ugly."
here should be one - and preferably only one - obvious way to do it."
Explicit is better than implicit" . 

Python, indents make Python clear
Python terminal. Type in "import this". The Zen of Python is shown.

- Python is used as a scripting language
The text file is directly executed as a code (Intepreter)

- Variables do not normally have to be declared.

Syntax is mandatory, which contributes to clarity. 
In addition, there are stylistic conventions, developers should stick to it, so that the code is easy to read and understand. 
These are listed in the Python Enhancement Proposal - PEP8 .
The program pycodestyle checks the code for PEP8.
With autopep8 the changes can even be made automatically.
autopep8 --in-place filename

  • Works with functions

Recurring sections of code are stored in functions. 
This makes work processes easier.

  • Object oriented programing

Python, like the "higher" programming languages ​​(C, C ++), is also a complex programming language. 
In this course, object-oriented programming is tackled during an additional day.

  • Open, community-based development model (Python Software Foundation)

Developers all over the world are working on the continuation of Python free of charge. 
This work is well organized. 
This keeps Python up to date. 
Vulnerabilities and errors are quickly eliminated.

  • Large standard library, platform independent

Programs run equally on Linux, MacOS and Windows.

  • Integration of further packages possible.

For Python there are special extensions. These are combined into so-called packages
Only required packages are included in the program.

  • Development environments

Development environments ( Integrated development environment - IDE ) for Python make programming easier. 
When entering the code suggestions are made. Thus, code can be cross-checked.

  • For Python, there are biological applications, documentation and tutorials around the world

Special modules and libraries used in biology are summarized. 
The best-known packages for biologists are Biopython and PyCogen 
The distribution Anaconda add many packages usefull for biologists.

More and more software can be programmed with Python. 
Examples from the graphics area are plugins for GIMP and ImageJ . 
The free 3D graphics software Blender ( Wikipedia ) can be programmed with Python. 

In LibreOffice and OpenOffice macros can be programmed with Python. 
(Currently this causes some security concerns: Heise online 5.2.19 "Security Updates : Dangerous Macros for LibreOffice")

Python is used by Internet companies like Google and YouTube ( Quotes )

It is easy to find corresponding documentation and tutorials on the internet .

  • History

Python was developed in the early 1990s by Guido van Rossum ,
(Wikipedia), Center of Wiskunde & Informatica in Amsterdam.

The name goes back to the English comic group Monty Python
So it has nothing to do with a snake. 
Or perhaps: John Cleese, member of Monty Python suggesting "Python" as "something slimy and slithery" and therefor using this name.
And Guido admired the group and therefore chose the name for his programming language.

Monty Python
Monty Python - Silly Walk -
Wegmann, Street art silly walk, modified by Steinmetz, CC BY-SA 3.0

How is Python executed?

Python must be installed on Windows machines. 
In contrast, Python is already installed on most Linux distributions (Debian, OpenSuse, Ubuntu, ...). 
Also on Apple Mac computers Python is pre installed.

Download and installation of Python
Python can be downloaded from the following page.
There are 2 versions of Python. Python 2 and Python3 ( see below ). 
Python 2 will be discontinued in 2020, so download Python 3 ( Python2 or Python3 )

This course uses a "Python package" or "Python distribution" that is installed along with many modules that are also useful for biologists. 
The free version of Anaconda ( Download ) is installed on the course computers. 
For example, the Anaconda Python is equipped with the modules to create diagrams and to elaborate data analysis ( NumPy , pandas ). 
In addition, the Spyder development environment will be installed. 

Installing several different packages is not a good strategy (For example Anaconda and Python(xy)). 
They fight for gaining the upper hand on the machine and both end up being dysfunctional.

On Windows computers, the "portable" WinPython can be installed. 
WinPython also includes many important packages along with the development environment Spyder and does not need to be installed on Windows. 
It can run on any folder or USB stick, therefore it is called "portable". 
Several versions can be stored on the computer. 
In addition, WinPython can be registered on the computer so that the Windows system variables are directed to the WinPython. 

The free Python (x, y) ( Download ), which was much used in biology before, only exists for Python 2.7 ( see below ) and has fallen asleep as a project.

Python Terminal or Command Prompt

Python can be run in a terminal or Command Prompt.

To do this, enter python in the terminal (Linux or MacOSX) or command prompt (Windows) .

Command Prompt example in Windows

  • Windows key + r
  • type " cmd "
  • type " python "

Run Python in the interactive console - here Windows 7
Run Python in the interactive Command Prompt - here Windows 7

It started Python with the installed version*. Then the prompt >>> is shown. 
This Python console will exit with the command 
exit () .

The Python terminal is only suitable for small programs.

* Windows may be reporting: "The python command could not be found."
During the installation python was not made aware of the Windows path variable.
Then go to the Python folder on the console with cd.
For example cd c:\Anaconda3\
or cd C:\Program Files\Python
where you find python.exe

You can also add the Python program folder to the environmental variables, system varible path
Open control panel: ->System ->Advanced system settings... ->Advanced ->Environmental variables ->System varible ->Path
Type in the path c:\Anaconda3\

Another possibility is to use the Windows Start button to call an Anaconda command prompt:
Windows Start -> Anaconda3 (64bit) -> Anaconda Prompt


IPython is an interactive command shell with even more features 
IPython can be called in the terminal or windows command prompt with the command

For installation, the packages Anaconda are best used. 
Installation and further information:

In the development environment ( IDE) Spyder has its own window for IPhyton. 

IPython running in the console
Python running in the console 

What are the benefits of IPython compared to the terminal? 

Output : The output is more readable, eg for dictionaries . 

Working with cells
With Ctrl + Enter you can work in a 'cell'. The code is sent to the python intepreter with Shift + Enter . 
This allows more complicated code to be implemented. 
Under Windows, use Ctrl + O at the command prompt . 

Tab Completion : With the key Tab you can search for a known variable, methods with the corresponding first letter. 
Similar works with file paths. If something like the beginning of a file path is entered (contains "/" on Linux and Mac), a list of matching file names will be displayed. 

Introspection: Question mark after a variable or function returns information. 
It can also be worked with the wildcard *. 

% run : A Python code in a file can be executed within IPython by  %run
For example, %run will execute the file. 

Any console command preceded by a "!" will be executed. 
Example !ping

Ctrl + Shift + V : Code can be pasted with Ctrl + Shift + V. See also the magic functions %paste and %cpaste

Shortcuts : Many special shortcuts are available. The easiest way to get information is with " %quickref" and "h"

magic commands : preceded by "%" and "%%" special IPython commands that execute magic commands are listed here
More information about a command can be found with "?" at the end of the command . 

- GUI Console: in the Windows command prompt, enter jupyter qtconsole
(earlier  Versions: ipython qtconsole --pylab=inline)
its own graphical interface will be opened. 

- search the command History : Ctrl + P (or down arrow), Ctrl + N (or up arrow) can be executed again.
To search in already typed code Ctrl + R (reverse search). 

-Record session : with %logstart, logstop and %logoff as well as %logstate the input and the output can be recorded.

Jupyter - IPython notebook

jupyter logo

IPython is being further developed as a Jupyter notebook and is included in the current Anaconda distribution. 
Overview . 
This is really a fantastic idea. The name derives from the 3 programming languages JuliaPython and R . 
In the meantime Haskell and Ruby have been added, which can be handled with jupyter.
This means that in addition to Python, you can also work with Julia, Haskell, Ruby or R in the notebook.

In the Kernel menu the appropriate language needs to be selected. Of course, the corresponding programs must be installed. 

JupyterLab is the successor product and is currently being developed in parallel with Jupyter Notebook.

Jupyter Notebook is a great way to work with IPython.
The notebook continues to run the IPython terminal.
The code can be typed in to a browser window.

Jupyter notebook is an ideal tool for Python tutorials.

Standard keyboard shortcuts 

Mac keyboard shortcuts
Microsoft Azure notebooks offer the possibility to work on their servers with the jupyter notebook
The advantage is that Python does not have to be installed. Python (2.7 and 3.5.x Anaconda 4.x) R and F # are installed on the Microsoft server. 
Everything takes place on the server. 
Disadvantage is, you have to sign up with a Microsoft account. Everything will be deleted after 60 days of inactivity. 
Intended for schools and research. At the moment everything is free, potentially such services might be charged in the future. 
Example, public access, for testing, the notebooks clone.
(If the link does not work, I have not updated in the last 60 days) 

jupyter notebook - text and code
Jupyter notebook - text and code. 

After the jupyter or Python notebook is installed, preferably with Anaconda, the jupyter is opened on the terminal . 
Then type the command

jupyter notebook
former versions: ipython notebook)

In Windows and Anaconda you can start Jupyter notebook also in Windows Start.
Anaconda place a link in Start Programs. 
Windows Start -> Anaconda3 (64bit) -> Jupyter Notebook 

In the default browser, a window opens in which the folders and files are displayed on the local PC. 
You can determine the starting point for folders with the command cd beforehand in the terminal.

A working directory can be set when calling (example: Desktop for Windows). 
jupyter notebook --notebook-dir=c:\Users\User name\Desktop

A new "notebook " can be created. It is divided into "Cells" that can be executed individually ( shift + Enter ) 
The "notebook " is saved with the file extension ipynb

The clever thing is that the session is saved and can be run again later. 
jupyter notebook is very well suited to the examples in the course. 
Apart from code, normal text can also be entered as an explanation, headings, etc.


JupyterLab is intended to replace Notebook and is being developed in parallel with Jupyter Notebook.
The same files can be used for both versions.
JupyterLab is a more effective user interface.
In the Windows command prompt or in the Anaconda prompt JupyterLab is called with
jupyter lab

In the browser (Firefox, Chrome,..) a new tab opens.

jupyter Lab - Text und Code
JupyterLab - text and code. 

jupyter notebook online

Google Colaboratory ("Colab") you can write and execute the python program in your browser (Chrome, Firefox, ...).

Here a short introduction.

No need to install Python with all the needed library on your computer. It is free for scientists and students.

Microsoft Azure notebooks offer the possibility to work on their servers with the jupyter notebook
The advantage is that Python does not have to be installed. Python (2.7 and 3.5.x Anaconda 4.x) R and F # are installed on the Microsoft server. 
Everything takes place on the server. 
Disadvantage is, you have to sign up with a Microsoft account. Everything will be deleted after 60 days of inactivity. 
Intended for schools and research. At the moment everything is free, potentially such services might be charged in the future. 
Example, public access, for testing, the notebooks clone.
(If the link does not work, I have not updated in the last 60 days) 

Tip Linux with Windows and Anaconda Python
There is the problem that some Python modules were developed only for Linux. How can I work with them in Windows?
It is possible to set up a virtual environment for Linux in Windows. For example VirtualBox from Oracle.
There is a second possibility! In the last few years Microsoft has created a Linux environment in Windows and developed it further and further.
In Windows 10 the "Windows Subsystem for Linux" WSL can be activated.
A bash terminal is set up, which is extended for example with an Ubuntu, Debian or CentOS app.
For Python and Jupyter Notebook Anaconda can be installed.
All this is described in a nice blog by Hugo Ferreira.

Code in a text file

Python Code - Code in Microsoft Notepad . 

With extensive code, it is clearer to save the code in a text file with the extension .py . 
The code is invoked with the program call for Python in the command prompt
For Windows with python.exe and the name of the program text file. 
In Windows the path and the extension .exe can be omitted, because in the successful installation of Python, 
by entering into the environment variables.

Open command prompt, in Windows with Windows key + R and enter "cmd". 
In our example, there are in the current folder a Python file named
Now enter the following into the command prompt:


The program is retrieved. If the command prompt is not in the same folder as the file, 
the path must be specified. 
For example, on Windows, if the file is in the Temp folder, use
python C:\Temp\

In some programs in addition, arguments could be specified which are processed in the program ( see below ).

Provided Python is installed, you can also double- click on a Python file under Windows . 
A command prompt window opens automatically. 
The program is executed. 
The result is shown and in a second the window closes automatically and you can't see the result. 
Therefore it is better under Windows to open the command prompt first and to type  python
There is a trick. Enter at the end of the program input(), then the program waits for an input and the window is not closed automatically. 
The result can be read and any input closes the window.

Python file can also be called in the Python console . 
>>> execfile ("C: /Temp/")

Note: Windows, use slash. Do not use backslash for the path. 

In IPython, calling a Python file with the magic command %run ( IPython ). 

The code is written using a simple 
text editor , such as Windows Notepad , Gnu Emacs, Vi, Nano (Linux). 
Under no circumstances use Word!

It is better to use a good text editor. 

Notepad ++ (Windows) 

BBedit (MacOS, free basic version) 
Atom (MacOS, Windows, Linux) 
atom .io / 

gedit (Linux) 

All programs marked the commands with color, which is a great help (Syntax highlighting). 

Finally, Python developers use special programs to develop and execute Python. 
This will be explained below under Development environments .

Python Online and Web Interface

There are now providers on the Internet who offer the Python platform online.

Python no longer needs to be installed on the machine.

The files can be reached on all computers.

Finally, a web application can be realized with Python.

Registration is necessary. The basic service is free. Enhanced services have to be paid.


There is another platform where many (indeed many!) Programming languages ​​can be run online.
For Python 3
Python does not need to be installed on the machine. 
Python2 and Python3 are possible. 
To test small codes it is quite useful 
Also simple IDE available

What happens when I start a Python program?

What are the exact procedures when Python starting the script in the command prompt (console, terminal)? 

The Python program is available as readable source code
File extension is py. The file extension is not a requirement to start the program. 
However, it makes the files clearer and is therefore recommended. 
You are using modules, the file extension is again crucial.

When the program is started with Python, the file is converted to a bytecode
We speak from compile a code.

This bytecode is not visible, but is saved as a file with the extension pyc.

The bytecode is made to work with the Python Virtual Machine - the program is executed.

Source code (> bytecode (m.pyc)> Python Virtual Machine (PVM)

In other programming languages, such as C ++, the code must always be translated first with a compiler  (Wikipedia). 
The compiler creates a readable bytecode for the platform (for example, Windows). 
This bytecode, also called machine code, is distributed and can be executed. These files are known under Windows as a file with extension exe
These programs are faster because the compilation step is eliminated when running the program. The compilation was already done before.

For Python, compilation is omitted on the 2nd execution unless the code has been changed because the bytecode is still there but is hidden.

Following are the advantages and disadvantages for Python compared to compiled programs (C ++).

+ With Python, the source code can always be read and edited 
Good for free programs, Universities
- Bad for companies that want to sell the software
+ Code runs smoothly on all platforms (Windows, Mac, Linux)
- Code is slower than C ++

In Python are modules written in C ++, 
if that's the rate-limiting step, now the programs are very fast (NumPy). 

See also CPython as a reference interpreter and PyPy a faster interpreter.

In exceptional cases you can manually compile the code.
The command to compile Python code in a folder is:

python -m compileall .
Don't forget the dot . at the end! The pyc file is now visible.

Further information:

Python Run Time Structure - Neeraj's Blog

From Python programs create Windows exe file:

There are some Python modules that can be used to create executables. 
The advantage is that Python does not have to be installed on the computer. 
However, these exe files are very large, because they had to contain the whole Python machine code.

Windows, Linux:

Windows: /


Development environments

Using editors (Notepad) to develop a Python program is not very effective. To write Python code there are specialized programs. 
Development environments or IDEs ( Wikipedia) make it easier to enter the code. 
With IDE you can also work with other functions, such as debugger (code error checking). 

A good summary can be found in the Hitchhikers Guide to Python .


The simplest development environment is IDLE.

IDLE means Integrated DeveLopment Environment - and Eric Idle was a founding member of Monty Python
IDLE is included in the default installation of Python.
IDLE is useful for beginners.


IDE - IDLE is included in Python download


Spyder is contained in the packages of Anaconda or the portable WinPython .

A short introduction to Spyder is available at 
Spyder is not the best IDE, but for Beginners less confusing than, for example, 
PyCharm . 
Since we want to focus on the Python structure we use Spyder in this course.

 IDE - Spyder 4 with dark Theme 

Tips for Spyder

Ctrl + Space -> Auto-complete, for example, variables, methods and functions. 
Ctrl + I -> the help system Inspector is opened for the function or method you are looking for 
Ctrl + S -> saves current page. 
Template for a new code page, see below . 
Triple clicking with the mouse marks a line -> line can be copied 
Ctrl + Alt + Down or Ctrl + Alt + Up Duplicates a line below or above


Since 2013 there is a free version of PyCharm JetBrains.
The community version is freely available on Apache 2 OpenSource. 
The software is written in Java and therefore also available under Linux, Windows and MacOSX. 
Students will be offered an interactive tutorial "PyCharm Education Edition" for Python:

Suitable for larger projects to edit. Paid additional functions.

Probably the best development environment for Python at the moment.


Fast and easy open source IDE for scientific Python development (" design is aimed at simplicity and efficiency ").
Windows, Mac and Linux

Included with WinPython .

A free IDE for Python. Supports Python 2 and 3.


Also useful is SciTe , which also supports other programming languages.


A good choise for developer programming in Python and same time want to program in other higher languages.
There is the plugin 
PyDev for the comprehensive developer environment Eclipse

Microsoft Visual Studio 2015

Anyone developing in Windows (.NET, etc.) will be pleased that there is now for Visula Studio 2015 the " Python Tools for Visual Studio " from Microsoft. 
The tools are free and open source.

Python 2 or Python 3

And now some unpleasant news. At the moment there are two pythons! 
Python 2.7.15 and Python 3.8.2 are currently available for download at . 
(Feb. 2020).

With Python 3 some substantial innovations were accomplished. 
Unfortunately, Python 3 is not backwards compatible . 

Since there are many programs in Python 2
and many modules and packages such as PythonXY which are only available for Python 2,
you will still have to work in Python 2 occassionally.

There is a Python script to turn Python 2 code into Python 3 code
2to3 - Automated Python 2 to 3 code translation )

Python 2.7 is called "legacy". . 
However, many developers are unhappy with Python 3 and stick to Python 2. 
Version 2.7 will be the last version of Python 2, there will be no Python 2.8. 
Security update for Python 2 is guaranteed only until 2020 (see ). 
Only Python3 is really evolving and being further developed.

Using magic command lines, see below, you can also run Python 3 programs with Python 2 (> version 2.6).

To make Python 3 scripts run in Python 2, use the following code at the beginning of the Python 2 program:

from __future__ import division

In Python 2, the result of dividing two integer numbers (2/3) is also an integer number ( integer ). In the example, the result is 0. 
This is called integer division (truncating division) . 
Python 3 results in a floating-point number ( float ). In the example, the result is 0.666666. 
In Python 3, the // operator can be used for integer division.
For background information, see this 
article .

A similar statement also exists for print , so that the code for Python 3 remains compatible.

from __future__ import print_function

Explanation under print () .

Coding, special characters and umlauts

Python3 should basically be programmed with UTF-8 and all identifiers with ASCII and with English words ( PEP8 ) 
This means no German "Umlaute" and special characters in the code. German designations should also be avoided.

The following applies to Python 2 and 3.
special characters are inserted in the comment and strings
insert at the beginning of the code (1st or 2nd line):

# - * - coding: utf-8 - * -

If the umlaut in the print function print('Tübingen')is still not displayed, the following can be used:

# - * - coding: iso-8859-1 - * -
and additionally
from __future__ import unicode_literals

This will automatically interpret all strings as Unicode strings.

Spyder instruction
These instructions can be automatically added to 
Spyder for each new program file. 
Open Spyder and open the " Preferences" menu with the " Tools" menu . 
Select the item " 
Editor "
tab " 
Advanced Settings " and the button " Edit templates for new modules ". 
Insert the instructions and save the

Literature, tutorials

Spitzweg 1850, Bücherwurm -
Carl Spitzweg artist QS:P170,Q164979, Carl Spitzweg 021,
Verändert von Steinmetz, CC0 1.0

Python documentation

Best place to find something, is still the official python documentation.

Python 3

Python 2

Literature, beginners

Dr. Martin Jones , Python for Biologists, ISBN 9781492346135, referenced by Amazon. 
Also available as an eBook
Martin Jones has written a great tutorial for biologists : 
This course follows the concept of Martin Jones. 
From the same author: 
Martin Jones. 2015. Python for complete beginners: A friendly guide to coding, no experience required

Bernd Klein , 2014, Introduction to Python 3, Carl Hanser Verlag 
The book starts with the claim 'Learn to program in a week'. 
But this is only possible with the first part (until page 189). 
The rest of the book offers a lot of information for sophisticated programming. 
Bernd Klein offers Python courses and his explanations are also understandable and competent. 
An online course can be found at

Michael Kofler, 2019, Python Der Grundkurs, Rheinwerk Computing.
Michael Kofler, known as a (Linux) computer book author, manages to compile the most important information from all important areas briefly and systematically.
Inexpensive book for beginners.

Further reading

Kenneth Reitz & Tanya Schlusser, 2017, Hitchhiker's Guide für Python.
Not a programming book, but the book about Python, how it works, installation, writing good code, develope Python projects.

Dr. Martin Jones , 2013, Advanced Python for Biologists,
Continuation of the classic "Python for Biologists". 
Didactically high level. 
From the same author 
2017 "Effective Python development for biologists."

Mitchell L Model , 2010, Bioinformatics Programming Using Python, O'Reilly, 1st Edition 

Allegra Via, Kristian Rother, Anna Tramontano, 2014, Managing Your Biological Data with Python, by Chapman and Hall / CRC. 
Many examples from biology, well explained. Less suitable for complete beginners.

Wes McKinney , 2012, Python for Data Analysis, O'Reilly. 
Data analysis with IPython and the modules NumPy and pandas 
Very good introduction with illustrative examples. Unfortunately no biological examples

DataScience mit Numpy und Pandas

Jake VanderPlas, 2017, Data Science mit Python: Das Handbuch für den Einsatz von IPython, Jupyter, NumPy, Pandas, Matplotlib und Scikit-Learn (mitp Professional)
Auf GitHub finden sich viele Beispiele von ihm als Notebook

Wes McKinney, 2012, Python for Data Analysis, O'Reilly.
Datenanalyse mit IPython und den Modulen NumPy und pandas
Sehr gute Einführung mit anschaulichen Beispielen. Leider keine biologische Beispiele

Tutorials, Online Python, Videos

Oliver Kohlbacher , Applied Bioinformatics Group - Online Lecture Timms
Lecture Bioinformatics for Life Sciences, 2nd Lesson
Lecture Bioinformatics for Life Sciences, 3rd
Lecture Lecture Bioinformatics for Life Sciences, 4th
Lecture Lecture Bioinformatics for Life Sciences, 5th Hours

Dr. Martin Jones - Python for Biologists

Programming Course for Biologists at the Pasteur Institute 
Unfortunately not available at the moment.

Bernd Klein - Python Online

Dr. Chuck (Charles Severance) - Videos, Audios, Examples

Codeacademy Python
Online Course, registration required, now chargeable
Online Course, no registration

Hitchhiker's Guide für Python
Not so much coding, but the whole thing in Python as a tutorial.
Also published as book (see above)

Help on the Internet

If you have a python code problem, google the problem, you always will find stackoverflow .

This is where the Python experts meet and can help with a problem. 
If not the problem has already been dealt with before.

Python at the University of Tübingen

KIS - Course at ZDV - Introduction to Python

Dr. Eberle Zentrum für digitale Kompetenzen
Zentrale Einrichtung an der Uni Tübingen

Oliver Kohlbacher , Applied Bioinformatics Group - Online Lecture Timms
Lecture Bioinformatics for Life Sciences, 2nd Lesson
Lecture Bioinformatics for Life Sciences, 3rd
Lecture Lecture Bioinformatics for Life Sciences, 4th
Lecture Lecture Bioinformatics for Life Sciences, 5th Hours

Oliver Kohlbacher , Applied Bioinformatics Group - Introduction to Python - link collection

Jan Benda - Introduction to Scientific Data Processing

Nano Science ZMBP Research Group Erik Schäffer

Kenneth Berendsen , ZMBP - Motif Mapper for Python -for-python /

Tobias Lachenmaier, Astrophysics Scientific Programming with Python SS2018

Machine Learning and neural Networks

Dieter Steinmetz, Universität Tübingen, ZMBP - Kursübersicht - Im Skript suchen