我有一个文本文件,其中包含访问我的应用程序的凭据,例如我的文本文件
#cat /etc/app/paswords
petter@domain.com $8324dhedberhnnhdbcdhgvged
userhappy@domain.com $2349cmjedcnecbcdfrfrrf8839
空格是制表符 我想用新密码更改密码散列或整行
我有以下代码:
#cat passreplace.py
domain = "midomain.com"
user = "userhappy"
email = user + "@" + domain
print email
if email in open('/etc/app/passwords').read():
print "User already exist!! one moment change your password"
#code to remplace password
谢谢
fileinput
是一个很好的选择。你知道吗相关问题 更多 >
编程相关推荐