W
washu
Hi,
This may be a simple problem but I can't seem to find a way around it.
I've pasted my code snippet below:
import os
input = os.popen("echo hello")
input.readline()
input.readline()
The first input.readline() gives the output. The second readline() gives
an empty line. It almost seems like input acts as a buffer which gets
emptied when you read it.
I even tried setting it equal to another variable (temp = input) but it
seems like temp receives a pointer that just points to input.
temp.readline() produces the same results.
I'd like to basically freeze the contents of input for further
manipulation or comparison. Any ideas?
This may be a simple problem but I can't seem to find a way around it.
I've pasted my code snippet below:
import os
input = os.popen("echo hello")
input.readline()
input.readline()
The first input.readline() gives the output. The second readline() gives
an empty line. It almost seems like input acts as a buffer which gets
emptied when you read it.
I even tried setting it equal to another variable (temp = input) but it
seems like temp receives a pointer that just points to input.
temp.readline() produces the same results.
I'd like to basically freeze the contents of input for further
manipulation or comparison. Any ideas?