I have a program on my machine which runs in my terminal window, and returns lists of info. For example:
t000930_152536.SFTC 1369.000
t031109_124140.SFTC 1369.000
t140207_071131.SFTC 3094.000
t190222_011122.SFTC 1369.000
t100423_011232.SFTC 1369.000
t190423_021543.SFTC 1369.000
t190714_205113.SFTC 3094.000
t110115_085319.SFTC 3094.000
All I want to do is to grab this info with Python – whether that be to write it into a file, or make it a list..
Here was my naive attempt:
#!usr/bin/python
import os
os.chdir('./P574/J0998-1034')
f = open('1400list.txt','w')
os.system('vap -c freq *.SFTC') # this tells my other programme to create its list
f.close
But the file created remains empty. Would love some help on this simple issue please!
Try normal file redirection.
Assuming, vap prints its information on stdout, this approach should work for you: