Mar 18, 2019 08:00 PM
(This post was last modified: Mar 18, 2019 08:24 PM by MaxiPads889.)
Hey guys! Quick question
Gives: (type = list)
['username1:password1\n', 'username2:password2\n', 'username3:password3\n']
Now how would I go about
Splitting this into seperate values so i can work with the user and pass independently?
Thank you
Edit: Here's what I ended up with, works, but it's messy.
Code
userpassFile = open("userpass.txt", "r")
list1 = userpassFile.readlines()
print(list1)Gives: (type = list)
['username1:password1\n', 'username2:password2\n', 'username3:password3\n']
Now how would I go about
Splitting this into seperate values so i can work with the user and pass independently?
Thank you
Edit: Here's what I ended up with, works, but it's messy.
Code
userpassFile = open("userpass.txt", "r")
list1 = userpassFile.readlines()
print(list1)
for each in list1:
each = each.strip()
# print(each.split(':')[0])
usernameStr = (each.split(':')[0])
passwordStr = (each.split(':')[1])
print(usernameStr)
print(passwordStr)

![[Image: nXAKuvJ.png]](https://i.imgur.com/nXAKuvJ.png)
![[Image: 3GxrPNr.png]](https://i.imgur.com/3GxrPNr.png)
![[Image: 0DvFxnA.gif]](https://i.imgur.com/0DvFxnA.gif)