Format strings in python are incredibly useful. The old-school way of writing them
involved the .format()
method that is available on strings.
txt = "github.com/{user}/{repo}/"
print(txt.format(user="koaning", repo="scikit-lego"))
A more modern take on this is to use f-strings. This should work on python 3.6 and up.
user = "koaning"
repo = "scikit-lego"
print(f"github.com/{user}/{repo}/")
This is a great method to turn variables into a string. But it does beg the question. How do we turn a string into variables now?
txt = "github.com/koaning/scikit-lego/"
We could write a regex to parse the information we'd like from this string. But that might be a heavy-weight tool. Instead, we might be better off using parse.
In this series of videos we'll highlight the main features from this library.