import keyring
import win32cred
def get_cred():
array = []
with open('D:\\UiPath\\凭据地址.txt', 'r', encoding='utf-8') as f:
for line in f.readlines():
line = line.strip()
a = win32cred.CredRead(line, 1)["UserName"]
b = keyring.get_password(line, a)
array.append([line, a, b])
return array
a = get_cred()
for row in a:
print(row)
打印结果为凭据的[网络地址,用户名,密码]的数组。