Here is my code
f = os.popen("java -version")
for i in f.readlines():
print "result, ", i,
Basically I want the output of java -version to be stored in f. What happens is, after the first line of the script executes, the java -version information is printed out, but not stored in f, hence the third line of code is not executed at all. This code works for other commands such as "ls -la", but not for java -version. Any ideas as to why?
Thanks in advance.