Read username and password from a file

This question already has an answer here:

  • In Python, how do I read a file line-by-line into a list? 35 answers

  • You should not be storing unencrypted login details in text files.

    However, here is a very simple solution anyway:

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

    上一篇: 在Python中读取文本文件时,每行都包含一个数组中的元素

    下一篇: 从文件中读取用户名和密码