摘要: 1.enumerate:返回2个值,1是当前的for循环的第几轮,2是循环得到的数值enumerate works by supplying a corresponding index to each element in the list that you pass it. Each time you go through the loop, index will be one greater, and item will be the next item in the sequence.choices = ['pizza', 'pasta', 'sa 阅读全文
posted @ 2013-10-21 11:25 邦邦酱好 阅读(3015) 评论(0) 推荐(0)
摘要: 关于string的split 和 join 方法对导入os模块进行os.path.splie()/os.path.join() 貌似是处理机制不一样,但是功能上一样。1.string.split(str=' ',num=string.count(str)): 以str为分隔,符切片string,如果num有指定值,则仅分隔num个子字符串。 S.split([sep [,maxsplit]]) -> 由字符串分割成的列表 返回一组使用分隔符(sep)分割字符串形成的列表。如果指定最大分割数,则在最大分割时结束。如果分隔符未指定或者为none,则分隔符默认为空格。注意:分隔 阅读全文
posted @ 2013-10-21 10:37 邦邦酱好 阅读(5054) 评论(0) 推荐(0)