怀旧不如怀春
疯子哥说,“怀旧不如怀春”. 大清早看这句话的时候,觉得这话有点委婉,然后晚上在实验室调试python的程序,累了又翻看他刚刚在荷兰照的花海,懵然觉得这孩子还挺闷骚的。
让我料想到这一点的是,当我思量着给python程序在shell中输入参数并进行自定义的时候。以往的我不会去想用python还输入参数,也不会想着去把python转换成exe。所以想来,天天去怀念久的方法,迷恋久的事物,还不如去寻找新的机会,和新的思路。也就是所谓的不破不立。对自己的一个启发就是,做好事务性的工作同时,一定要花一点时间去尝试新的事务。
PS:推荐py2exe给大家,一个用来将python转换为exe的module,大家有空就easy_install 一个试试,要新建一个setup.py.
from distutils.core import setup import py2exe ''' to relsease the code. ''' setup(console=['main.py'])
然后,在shell环境下调用 python setup.py py2exe
这样就会很容易的生成一个dist文件,其中包含了转换而成的exe文件。
而关于如何传参数给python module,首先要import optparse,其次就是写出参数的option字母,并在后面输入参数。例如perrygeo中的hilshade.py的代码:
parser = optparse.OptionParser('usage: ...') parser.add_option('-i', '--input', dest='input', help='Input file') parser.add_option('-o', '--output', dest='output', help='Output file') (options, args) = parser.parse_args() input, output = options.input, options.output
Related posts:
About this entry
You’re currently reading “怀旧不如怀春,” an entry on Geoinformatics
- Published:
- 4.16.09 / 1上午
- Tags:
- Land Use
Ajax ArcGIS Dreams Flex Geography Geoinformatics GeoRSS GIS Google Hardware Harvard History Jquery Linux Love Map MapServer NASA OGC OpenGIS OSGeo PHP Politics PostGIS PostgreSQL Python R Social Network SVG Ubuntu Web WebGIS Wordpress 中国 历史地理 宋朝 开源 新儒学 生活 遥感
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.














赵 博 (Bo Zhao),
参与或主持的项目
No comments
Jump to comment form | comments rss [?] | trackback uri [?]