Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which is better? Using inbuilt python functions or os.system commands?

Tags:

python

Which is better to use in a python automation script for following simple operations To create a zip file and copy it or rename it to a new location. Using python inbuilt functions or terminal commands through os.system modules is better?

like image 917
MarrT Avatar asked Jun 13 '26 09:06

MarrT


1 Answers

The inbuilt Python modules/ stdlib wherever you can, subprocess (os.system) where you must.

Reasons: Portability, maintenance, code readability just to name a few.

like image 172
user225312 Avatar answered Jun 15 '26 03:06

user225312



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!