I'm sure there's an easy answer to this, I just can't seem to figure out what's the best solution.
I have a text file that contains the following: a username and a password. An example is below:
mcgoga12,password
shelby12,password1
I want to open this file, and read in the file. However, I want to store the username (mcgoga12, etc...) and the password (password, etc...) in two separate lists.
Does anyone have a specific suggestion as to how to parse this?
Here's what I've tried:
with open("credentials.txt", "r") as infile:
users = infile.read().rsplit(',',3)
print users
However, I keep getting this output (clearly its not separating it)
['mcgoga12', 'password\nshelby12', 'password1\n']