how to change python version on linux
#Check available versions
ls /usr/bin/python*
#Change the used version 3.5 or 3.7 etc
alias python='/usr/bin/python3.x'
#do this other thing
. ~/.bashrc
#Check version
python --version
how to change python version on linux
#Check available versions
ls /usr/bin/python*
#Change the used version 3.5 or 3.7 etc
alias python='/usr/bin/python3.x'
#do this other thing
. ~/.bashrc
#Check version
python --version
change default python version
sudo update-alternatives --config python
set default python
newDict = {1:"One",
2:"Two",
3:"Three"}
x=newDict.setdefault(4,"Four")
print(newDict[4])
#returns Four
newDict2 = {1:"One",
2:"Two",
3:"Three",
"Hello":"World"}
y=newDict.setdefault("Hello","Yellow")
print(newDict2["Hello"])
#returns World
dict1 = {1:"One",2:"Two"}
x=dict1.setdefault(3,"Three")
x=dict1.setdefault(2,"Duo")
print(dict1)
#prints {1: 'One', 2: 'Two', 3: 'Three'}
#Therefore if value doesn't exist it is given default value, else value of key is returned.
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us