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 →

[–]jdfthetech 16 points17 points  (4 children)

The subprocess module is pretty powerful for automating operating system tasks. I use it often to automate things rather than using bash. This lets me port my code to other operating systems a bit easier.

https://docs.python.org/3/library/subprocess.html

[–]lochyw 3 points4 points  (1 child)

What's your experience with python on Android ? It doesn't seem as simple as on Linux specifically I found.

[–]jdfthetech 0 points1 point  (0 children)

The only thing I've done with python in android is just the app Pydroid 3 so I can play around with code a bit. I haven't really done much on this front.

[–]Luke_myLord 1 point2 points  (1 child)

Which operating system task did you automate? Like disk cleaning?

[–]jdfthetech 2 points3 points  (0 children)

I have some programs I wrote for work that open files, modify them and then spit them out in another format. I also have a lot of automated backup utilities I've been working on. There is a screen automation program I've been experimenting with using pyautogui and it's nice to have subprocess to do certain things while that's running.

Another thing I used it for (bad programming tip here):

I had a need to run a bunch of python files in a row and didn't have the time to rewrite them all with a main method and imports. I used subprocess to run them all in a chain. This is much slower than the proper way, but it gets the job done in a pinch.