Bioinformatics Laboratory at BiUH.
Core Values: Respect, Reflection, Communication, Commitment.
.py file containing Python code__init__.py)Three primary ways to import libraries:
import module_namemodule_name.function()from module_name import function_namefunction_name() directlyimport module_name as aliasalias.function()from module_name import function as aliashelp('modules')pip3 install package_namepip3 uninstall package_namepip3 list (shows installed packages with versions)pip3 install --upgrade package_namepip3 install package_name==versionpip3 --versionpip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple package_namepip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple~/.config/pip/pip.confmath.pi, math.sqrt(), math.pow()datetime.datetime.now(): Returns current local time (year, month, day, hour, minute, second, microsecond)datetime.timedelta(): Represents time intervals for calculations
days, hours, minutesstrftime("%H:%M") creates custom time stringsrandom.choice(sequence): Selects random elementrandom.randint(a, b): Returns random integer between a and b (inclusive)os.path.exists(path): Checks if path existsos.makedirs(path): Creates directory (including parent directories)os.listdir(folder): Lists all files in directoryos.path.join(path, file): Safely joins path componentsshutil.copy2(src, dst): Copies file while preserving metadataresponse = requests.get("URL")
response.status_code # HTTP status code
response.text # Response content as string
f"http://wttr.in/{city}?format=3"datetime for timestamps with requests for data fetchingdatetime.datetime.now() returns local system timeos.path.exists()os.makedirs() if neededos.listdir()shutil.copy2() or similar functions