随笔分类 -  python

摘要:#设a为字符串import timea = "2011-09-28 10:00:00"#中间过程,一般都需要将字符串转化为时间数组time.strptime(a,'%Y-%m-%d %H:%M:%S')>>time.struct_time(tm_year=2011, tm_mon=9, tm_mda... 阅读全文
posted @ 2014-03-18 20:33 children 阅读(10550) 评论(0) 推荐(0)
摘要:+---+---+---+---+---+ | H | e | l | p | A |+---+---+---+---+---+0 1 2 3 4 5-5 -4 -3 -2 -1s[0:4]、s[-5:-1]得到的是Help,也就是从下标0(-5)开始,取下标右边的字符,直到下标为4(-1)。下标为4(-1)的右边字符不取。同理,s[4:1:-1]、s[-1:-4:-1]得到的是 Apl要得到倒序,可以是s[4::-1](不能写为s[4:-1:-1]) ,s[-1::-1]和s[-1:-6:-1] 阅读全文
posted @ 2013-10-04 22:33 children 阅读(277) 评论(0) 推荐(0)
摘要:$test="hello world"$python -c "print '$test'.split()[1]"world或者$test="hello world"$a="$(python -c "print '$test'.split()[1]")"$echo $aworld 阅读全文
posted @ 2013-09-26 23:57 children 阅读(616) 评论(0) 推荐(0)
摘要:转自:http://www.cnblogs.com/rhcad/archive/2011/12/21/2295507.html 这是在Python学习小组上介绍的内容,现学现卖、多练习是好的学习方式。 第一步:最简单的函数,准备附加额外功能 ? ... 阅读全文
posted @ 2012-11-29 16:37 children 阅读(265) 评论(0) 推荐(0)