(Jul-21-2020, 07:02 AM)bowlofred Wrote: Your first error is because you've set "x" to be the return value ofprint()
. 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 dobetalines[0].split()
.
beta = open('beta.txt', 'rt') betaline = beta.readline() y = betaline.split()[3] print(y)
Output:928.2M,
Thankyou so much. I wanted to clarify one last thing though. My value is stored in the variable y. So now when I have to execute the python command:
grgsm_livemon_headless -f 944.2MCan I simply replace the value of the frequency (in this example 944.2M) by y?
Thanks again.
edited: I tried again. the command doesnt pick up the value of y as a variable and returns the following error
Error:grgsm_livemon_headless: error: option -f: invalid engineering notation value: 'y