从文件中读取用户名和密码

这个问题在这里已经有了答案:

  • 在Python中,如何逐行读取文件到列表中? 35个答案

  • 您不应该将未加密的登录详细信息存储在文本文件中。

    不过,无论如何,这是一个非常简单的解决方案:

    f=open("/authentication/account.txt","r")
    lines=f.readlines()
    username=lines[0]
    password=lines[1]
    f.close()
    
    链接地址: http://www.djcxy.com/p/42347.html

    上一篇: Read username and password from a file

    下一篇: Read TXT file line by line