How can I get the output of subprocess to append a list in the format as per my code below. I have searched this site but could not find a clear answer
import subprocess
stafflist = 'staff.text'
passfile =[] # Generated from passgen_64
newDate = str(input('Enter new expiry date "Format = yyyy-mm-dd" '))
train_accounts = []
newAccounts = []
userFile = []
with open(stafflist) as file_object:
lines = file_object.readlines()
for line in lines:
if line.startswith('train'):
train_accounts.append(line.rstrip().split(':'))
pgen=subprocess.call(['/usr/bin/passgen_64'])
passfile.append(pgen)
print (passfile)
Input :2020-11-11
YnJ1dHJhbGF0cmE=
amE5NXN0eWJydXJp
c3R5ZHJ1c3Rv
cHJ1Z3Jhdmk=
YnJ1Z3JpZHJl
Output :
[0, 0, 0, 0, 0]
which is not I want, I need passfile to be: ['YnJ1dHJhbGF0cmE=','amE5NXN0eWJydXJp','c3R5ZHJ1c3Rv','cHJ1Z3Jhdmk=','YnJ1Z3JpZHJl']