如何从文本文件读取登录信息?

时间:2018-09-18 17:33:29

标签: python login text-files

我正在创建一个登录系统,但是我不知道如何从我的登录系统中读取变量...我要在带有“?”的部分添加什么,文本文件称为“ InfoStore”

plt.fill_between(range(len(x_axis)), negative_means+negative_std, negative_means-negative_std, facecolor='blue', alpha=0.3)
plt.tight_layout()

1 个答案:

答案 0 :(得分:-1)

您可以发布完整的代码吗?

如果文件名为“ InfoStore.txt”:

# Opens the file and stores it in the file variable.

with open("InfoStore.txt", "r") as file:

    # file.read() returns all of the text in the file as one string,
    # including newline characters

    text = file.read()

尚不清楚您如何存储用户名和密码,但它们存储在 文本变量,因此找到一种从字符串中提取详细信息的方法。