Your first error is because you've set "x" to be the return value of
readlines() reads all the lines in the file. If you only have one line, you might prefer readline().
If you want to split the line (which was previously "betalines[0]"), you'd do
print()
. print() has no return value, so "x" becomes None. What did you want x to be?readlines() reads all the lines in the file. If you only have one line, you might prefer readline().
If you want to split the line (which was previously "betalines[0]"), you'd do
betalines[0].split()
. beta = open('beta.txt', 'rt') betaline = beta.readline() y = betaline.split()[3] print(y)
Output:928.2M,