Instead of every time you execute python or ipython, have to write "import os" or other common packages, this script will start python with these packages imported
#!/usr/bin/env bash
# -------------------------------------------------------------
# Calls ipython or python3 with multiple packages imported
# -------------------------------------------------------------
if [[ -z "$1" ]] || [[ -f "$1" ]]; then
[[ -n "$(command -v ipython3)" ]] && EXEC="ipython3" || EXEC=python3
TMP_PY=/$TMPDIR/$EXEC.py
printf "import os, re, sys, math, datetime, yaml\n" >$TMP_PY
$EXEC -i $TMP_PY "$@"
else
python3 "$@"
fi

The above is the detailed content of How to start python or ipython with packages pre-imported.. For more information, please follow other related articles on the PHP Chinese website!
How to solve 400badrequest
How to get the length of an array in C language
What are the methods to implement operator overloading in Go language?
How to apply for registration of email address
What are the ways to write iframe?
How do PR subtitles appear word for word?
modify ip
OuYi Exchange app download