0

Hi I'm working with a python script, and I need to run some terminal commands but I dont want to see the result of them. I'm using this code:

comando = ('fping -c1 -g 192.168.1.0/24')
valor = os.system((comando))
comando = ('arp -n > /home/edgar/Documentos/wips/arp')
valor = os.system((comando))

The terminal show me the list of the fping command.

Is there a way to do what I want?

1 Answers1

2

i would avoid using os.system in favor of this but given your code you could redirect the stdout and stderr to /dev/null:

comando = ('fpin -c1 -g 192.168.1.0/24 > /dev/null 2>&1')
valor = os.system(comando)
Community
  • 1
  • 1
odradek
  • 993
  • 7
  • 14