这是我最近写的一个将Camel发布在maven2的shapshot schema 拷贝到指定目录下的[url=https://svn.apache.org/repos/asf/activemq/scripts/copy_snapshot_xsd.py]python小脚本[/url]。
发现自己开始迷恋上了python,体验着一种新的写程序的方式。
以前不管是用bash 还是写windows bat,就是简单的设置一下环境变量然后调用一下写好的程序,很少做一些逻辑的判断(小声说,复杂的我也不会)。而用python在写脚本的同时不刻意拘泥与C++或者Java的强类型处理,简单几行代码就完成了处理文件的操作,突然感觉写程序会如此的轻松。
下面是从python tutorise 上面拷贝下来的,你在什么的情况下使用python.
If you do much work on computers, eventually you find that there's some task you'd like to automate. For example, you may wish to perform a search-and-replace over a large number of text files, or rename and rearrange a bunch of photo files in a complicated way. Perhaps you'd like to write a small custom database, or a specialized GUI application, or a simple game.
If you're a professional software developer, you may have to work with several C/C++/Java libraries but find the usual write/compile/test/re-compile cycle is too slow. Perhaps you're writing a test suite for such a library and find writing the testing code a tedious task. Or maybe you've written a program that could use an extension language, and you don't want to design and implement a whole new language for your application.
作为对传统语言的扩展,你可以把 python看成是一个超级胶水,通过这个超级胶水可以让在已有的库函数上快速构建自己需要的应用,如果当前的库不好用,或者没有适合你的使用的库,你可以用C或者Java写一个简单的扩展然后交给python来调用。
如果你想让你做的系统操作更简单,或者把你从沉重而重复的命令行指令中解脱出来,和我一样学习python吧。
发现自己开始迷恋上了python,体验着一种新的写程序的方式。
以前不管是用bash 还是写windows bat,就是简单的设置一下环境变量然后调用一下写好的程序,很少做一些逻辑的判断(小声说,复杂的我也不会)。而用python在写脚本的同时不刻意拘泥与C++或者Java的强类型处理,简单几行代码就完成了处理文件的操作,突然感觉写程序会如此的轻松。
下面是从python tutorise 上面拷贝下来的,你在什么的情况下使用python.
If you do much work on computers, eventually you find that there's some task you'd like to automate. For example, you may wish to perform a search-and-replace over a large number of text files, or rename and rearrange a bunch of photo files in a complicated way. Perhaps you'd like to write a small custom database, or a specialized GUI application, or a simple game.
If you're a professional software developer, you may have to work with several C/C++/Java libraries but find the usual write/compile/test/re-compile cycle is too slow. Perhaps you're writing a test suite for such a library and find writing the testing code a tedious task. Or maybe you've written a program that could use an extension language, and you don't want to design and implement a whole new language for your application.
作为对传统语言的扩展,你可以把 python看成是一个超级胶水,通过这个超级胶水可以让在已有的库函数上快速构建自己需要的应用,如果当前的库不好用,或者没有适合你的使用的库,你可以用C或者Java写一个简单的扩展然后交给python来调用。
如果你想让你做的系统操作更简单,或者把你从沉重而重复的命令行指令中解脱出来,和我一样学习python吧。