I am trying to see if myfile returns nothing after a grep from within python, something like this:
command="cat my_file.txt | grep 'string_to_find'"
if os.system(command) == '':
print('nothing found')
>Solution :
Converting comment to answer:
command="cat my_file.txt | grep 'string_to_find'"
if os.popen(command).read() == '':
print('nothing found')