I have a program that need to use something like that:
file1=open("cliente\\config.ini","r")
print file1.read().split(",")
user=file1.read().split(",")[0]
passwd=file1.read().split(",")[1]
domain=file1.read().split(",")[2]
file1.close()
In the file there is 3 strings separated by a "," (user,pass,domain).
This is the output:
['user', 'pass', 'domain']
Traceback (most recent call last):
File "C:\Users\default.default-PC\proyectoseclipse\dnsrat\prueba.py", line 8, in <module>
passwd=file1.read().split(",")[1]
IndexError: list index out of range
I am taking the 0, 1 and 2 strings in the list so I am not taking one that does not exist.
So, why I am having an error??
Thank you very much.