I am really having some issues with getting clean output from python after reading in a file.
Here is my code so far:
user_pass_list = []
count = 0
for Line in open(psw):
fields = Line.strip("\n").strip(",").split(":")
user_pass_list.append(fields)
count = count + 1
print (count)
for item in range (0, count):
print (user_pass_list[item])
Here is what I keep getting as output:
['administrator', 'admin']
['']
['administrator', 'password']
['']
['admin', '12345']
['']
['admin', '1234']
['']
['root', 'root']
['']
['root', 'password']
['']
['root', 'toor']
Here is the text file that I am trying to read in to a list.
administrator:admin
administrator:password
admin:12345
admin:1234
root:root
root:password
root:toor
Could someone please help me? What I want is for each field to have its own list.
users[0]="administrator"
passwords[0]="admin"
users[1]="administrator"
passwords[1]="password"
Any suggestions?
listyou want adictionary.