Requesting password in IPython notebook

前端 未结 1 724
情歌与酒
情歌与酒 2021-02-02 08:19

I have an IPython notebook which accesses data via SSH using encrypted ssh key file. I don\'t want to store the password in the notebook (nor in a separate file). I can use

相关标签:
1条回答
  • 2021-02-02 08:39

    You should import the getpass module, then call getpass.getpass.

    import getpass
    password = getpass.getpass()
    

    Note that in old versions, the field where you enter the password may not appear in the IPython Notebook, but instead in your terminal/command prompt window. In the latest versions of Jupyter Notebook, however, the prompt will appear in the Notebook itself.

    0 讨论(0)
提交回复
热议问题