Showing all posts tagged python:

Fetch German laws

In this part of series, I will describe, how to fetch German law texts from https://www.gesetze-im-internet.de. Four formats The (federal) laws in Germany are published by the Federal Ministry of Justice and Consumer Protection on https://www.gesetze-i...

Run IDLE (Python IDE) in virtual environment

Imagine: you are running software implemented in Python and there is a problem you would like to debug or edit away. The software resides in a virtual environment and apart from this virtual environment and a standard Python installation nothing else i...

Python shebang

Currently, in the interregnum where Python 2 and Python 3 may co-exist on the same system, the PEP 0394 recommendations for the shebang line in Python programs run in short like this: Use #!/usr/bin/env before Python interpreter Use #!/usr/bin/env pyt...

Print in Python without newline

If you want to print a string in Python without newline at the end, do it like this: # ... and if you are in Python 2: from __future__ import print_function print('.', end='')

Print default values of CLI arguments in Python

If you would like to print default values of command-line arguments and if you use the argparse.ArgumentParser class in your Python program, consider setting the formatter_class option to argparse.ArgumentDefaultsHelpFormatter. Example code: argparser ...