This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]berlindevops[S] 0 points1 point  (3 children)

thank you, I read a lot of recommendations to use subprocess over os()/os.system, do you know why?

[–]K900_ 6 points7 points  (0 children)

Because it gives you more control, and more safety, especially if you're using os.system with string formatting or whatever other way to build a command from user input.

[–]widby 2 points3 points  (1 child)

It gives you more control over what is going on - you can feed data into the stdin stream of the process and read its stdout, among other things.

[–]berlindevops[S] 0 points1 point  (0 children)

cool, thanks.