Cheuk Ting Ho
Developer advocate / Data Scientist - support open-source and building the community.
Online Absolute Beginner Python Tutorials
Every Sunday 2pm (UK time/ BST)
by Cheuk Ting Ho
Get this slide deck:
slides.com/cheukting_ho/python-os-subprocess
Beginner topics:
Python objects, Control flows,
Functions, modeuls, classes and decorators
strings operations and regex with re
Testing:
pytest with fixtures and mock
property-based testing
python linters & auto-formatters
TDD, type hinting
Intermedite topics:
Iterators, generators, async
Packaging:
generating docs, pypi
Others:
Functional Programming
In Python you can use open() to get access to a file
https://www.w3schools.com/python/python_file_handling.asp
open() returns a file object which provide lot's of various operations
This module provides a portable way of using operating system dependent functionality.
https://docs.python.org/3/library/os.path.html#module-os.path
The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes.
output = subprocess.run(
[
"docker-compose",
"--file",
os.path.dirname(os.path.realpath(__file__)) + "/test-docker-compose.yml",
"up",
"-d",
],
stderr=subprocess.PIPE,
)
if output.returncode != 0:
raise RuntimeError(output.stderr)
Sunday 2pm (UK time/ BST)
There are also Mid Meet Py every Wednesday 6pm
By Cheuk Ting Ho
Developer advocate / Data Scientist - support open-source and building the community.