+ 1

What is the difference between os.system and subprocess module in Python?

Both are used to call system commands inside Python ..but what are the notable differences and how to pipe commands in both of them.

4th Jun 2017, 10:32 AM
suryapoojary
suryapoojary - avatar
1 Odpowiedź
+ 5
<< You should use subprocess. Not that it makes any difference, it's just newer module intended to replace os.system (have a look at this section [ http://docs.python.org/2/library/subprocess.html#replacing-os-system ] for a drop-in replacement). It also has more features in case you need them one day. In short: there is no reason to use os.system (except for compatibility with older versions of Python). >> Source: https://stackoverflow.com/questions/17094423/os-system-vs-subprocess-in-python-on-linux And about your second question: https://www.google.com/search?q=pipe+command+python
4th Jun 2017, 11:01 AM
visph
visph - avatar