2013年3月27日

自己用的vim配置文件 .vimrc

摘要: python和c可以自动缩进 1 " filename:.vimrc 2 " author:h3idan 3 4 set nocompatible "非兼容模式 5 syntax on "开启语法高亮 6 set background=dark "背景色 7 8 " 配色方案 9 "color peaksea 10 color desert 11 12 set filetype=python 13 14 set modeline 15 set ruler "在左下角显示当前文件所在行 16 set showcmd 阅读全文

posted @ 2013-03-27 15:38 h3idan 阅读(272) 评论(0) 推荐(0) 编辑

python dict根据value排序

摘要: 用一个sorted这个内置函数,可以字典排列成一个list的元组。1 #!/etc/bin/env python2 #conding: utf-83 4 d = {'a': 1, 'b': 12, 'c': 3, 'd': 0}5 6 sorted(d.items(), key=lambda x: x[1]) # d.items() 将dict中key-value转化成元组形式, x[1]就是元组中的第二个元素 阅读全文

posted @ 2013-03-27 15:22 h3idan 阅读(197) 评论(0) 推荐(0) 编辑

python 冒泡排序

摘要: 1#!/usr/bin/envpython2#coding:utf-834#**********************************5#author:h3idan6#datetime:2013-03-1318:427#**********************************8910defbubble_sort(list1):11foriinranage(len(a)-1):12forjinrange(len(len(a)-i-1)):13iflist1[j]>list1[j+1]:14list1[j],list1[j+1]=list1[j+1],list1[j]1 阅读全文

posted @ 2013-03-27 15:10 h3idan 阅读(123) 评论(0) 推荐(0) 编辑

导航