Would Python make a good substitute for the Windows command-line/batch scripts?

后端 未结 12 867
醉酒成梦
醉酒成梦 2021-01-30 07:21

I\'ve got some experience with Bash, which I don\'t mind, but now that I\'m doing a lot of Windows development I\'m needing to do basic stuff/write basic scripts using the Wind

12条回答
  •  清酒与你
    2021-01-30 07:49

    As a follow up, after some experimentation the thing I've found Python most useful for is any situation involving text manipulation (yourStringHere.replace(), regexes for more complex stuff) or testing some basic concept really quickly, which it is excellent for.

    For stuff like SQL DB restore scripts I find I still usually just resort to batch files, as it's usually either something short enough that it actually takes more Python code to make the appropriate system calls or I can reuse snippets of code from other people reducing the writing time to just enough to tweak existing code to fit my needs.

    As an addendum I would highly recommend IPython as a great interactive shell complete with tab completion and easy docstring access.

提交回复
热议问题