Python Code Tips
Python Code Tips
How to upgrade PIP
python -m pip install --upgrade pip
Upgrade an individual package
pip install <package name> --upgrade
Install packages from a requirements file
pip install -r requirements.txt
The requirements file is a line delimited with the package name and optional parameter for the version
Example: Get the latest package version
pandas
scikit-learn
scipy
Example: Get a specific version
pandas==0.22.0
scikit-learn==0.19.1
scipy==1.1.0
Traverse a directory structure
import os
for dir_name, sub_dir_list, file_list in os.walk(input_folder_path, topdown=False):
for file_name in file_list:
print(file_name)