09 2014 档案

摘要:思路是把字典转为列表后再排序d={'z':1,'y':2,'x':3} # 字典s=d.items() # [('y', 2), ('x', 3), ('z', 1)] 列表s.sort() # [('x', 3), ('y', 2), ('z', 1)] 排序列表# 或者连起来写(sort是... 阅读全文
posted @ 2014-09-30 11:37 ibg 阅读(266) 评论(0) 推荐(0)
摘要:string类型是不可变的,因此不能采用直接赋值的方式。比如一个字符串 helloworld,想把o替换成z,那么只有先替换,然后再迭代。strings="helloworld"hello=strings.replace('o','z')for index,string in enumerate(h... 阅读全文
posted @ 2014-09-30 11:31 ibg 阅读(346) 评论(0) 推荐(0)
摘要:一、安装1、# apt-get install wine安装完后在终端里运行wine:# wine会弹出一个对话框:This is the wine64-bin helper package, which does not provide wine itself,but instead exists... 阅读全文
posted @ 2014-09-21 19:28 ibg 阅读(2647) 评论(0) 推荐(0)
摘要:在python2和python3共存的机器上做开发,要想互不干扰,虚拟环境很重要。Debian7 默认是python2.7.3,装好python3.4.1后怎么建立虚拟环境呢?$ pyvenv myVenv$ source myVenv/bin/activate然后就可以在虚拟环境中安装程序了。如:... 阅读全文
posted @ 2014-09-11 20:13 ibg 阅读(454) 评论(0) 推荐(0)