How-to articles, tricks, and solutions about PYTHON
Getting the class name of an instance
To get the class name of an instance in Python, you can use the __class__ attribute of the object.
Getting today's date in YYYY-MM-DD in Python?
You can use the datetime module in Python to get the current date in the YYYY-MM-DD format.
How can I access environment variables in Python?
You can use the os module in Python to access environment variables.
How can I check for NaN values?
You can use the isnan() function provided by the math module to check if a value is NaN.
How can I delete all local Docker images?
To delete all local Docker images, you can use the following command:
How can I do a line break (line continuation) in Python?
In Python, you can use the "" character to indicate a line continuation.
How can I find where Python is installed on Windows?
To find where Python is installed on Windows, you can follow these steps:
How can I flush the output of the print function?
To flush the output of the print function, you can use the flush parameter of the print function.
How can I get a value from a cell of a dataframe?
You can use the .at or .iat methods to get the value of a specific cell in a DataFrame.
How can I get list of values from dict?
You can use the values() method to get a list of values from a dictionary:
How can I get the concatenation of two lists in Python without modifying either one?
There are a few different ways to concatenate two lists in Python without modifying either one.
How can I iterate over files in a given directory?
You can use the os module in Python to iterate over files in a given directory.
How can I make a Python script standalone executable to run without ANY dependency?
One way to make a Python script standalone executable is by using the package pyinstaller.