4. Confidential InformationΒΆ

Chinese proverb

Be mindful of guarding against harm from others, and stay away from placing harming upon others.

If you are a real Data Scientist, you have to share your code with your colleagues or release your code for Code Review or Quality assurance(QA). You will definitely do not want to have your User Information in the code. So you can save them in login.txt in a safe folder:

runawayhorse001
PythonTips

and use the following code to import your User Information:

#User Information
try:
    login = pd.read_csv(r'login.txt', header=None)
    user = login[0][0]
    pw = login[0][1]
    print('User information is ready!')
except:
    print('Login information is not available!!!')

You may also want to get the User Information by using os.environ in Python:

try:
    user = os.environ['LOGNAME']
except OSError:
    user = os.environ['USER']
except OSError:
    user = os.environ['USERNAME']
    print(err)
except OSError as err:
    print('The user information is not available!!!')