Safa Mulani

Safa Mulani

An enthusiast in every forthcoming wonders!
Python PIP - Package Manager

Python PIP – Package Manager

When a Python project needs a library, the first task is finding a package that fits what the code needs. pip installs Python packages from PyPI or another configured package index. This article shows how to search PyPI by purpose…

Python replace() function

Python replace() function

Calling `”Python python PYTHON”.replace(“python”, “Ruby”)` changes only the lowercase match. I appreciate the `count` argument because it caps how many matches change. Pass the old and new text to `str.replace()` and check the returned string. Compare that returned string with…

Understanding Python f-string

Understanding Python f-string

Debug prints all repeat the same chore, because the variable name gets typed once as a label and once as the value. The f-string shorthand prints both from a single expression, so the label can never drift out of sync…

Python String join() function

Python String join() function

Every list of strings eventually needs to become one string, and the line that does it reads backwards. The separator calls the method while the list supplies the items, so a comma-joined row comes out as a one-liner once you…

Python Namedtuple

Python Namedtuple

I first ran into namedtuples when debugging a data pipeline. Reading record[0] and record[1] everywhere was a nightmare – switching to record.city and record.state was a instant clarity upgrade that I came back to every time. A namedtuple is a…