摘要: 1- "原地"排序-转换后替换>>> list = [2,1,3]>>> list.sort()>>> list[1, 2, 3]降序 reverse = True>>> list.sort(reverse = True)>>> list[3, 2, 1, 1]2- "复制"排序-转换然后返回>>>... 阅读全文
posted @ 2014-06-18 15:54 galoishelley 阅读(275) 评论(0) 推荐(0)
摘要: 读取4个文件内容,格式化数据,升序,显示每个文件前3个数据julie.txt2.59,2.11,2:11,2:23,3-10,2-23,3:10,3.21,3-21james.txt2-34,3:21,2.34,2.45,3.01,2:01,2:01,3:10,2-22sarah.txt2:58,2... 阅读全文
posted @ 2014-06-18 15:33 galoishelley 阅读(628) 评论(0) 推荐(0)
摘要: 1- strip()方法可以从字符串去除不想要的空白符(role, line_spoken) = each_line.split(":", 1)line_spoken = line_spoken.strip()2- print() BIF的file参数控制将数据发送/保存到哪里print(...) ... 阅读全文
posted @ 2014-06-18 11:30 galoishelley 阅读(222) 评论(0) 推荐(0)
摘要: sketch.py 1 #--*-- coding:utf-8 --*-- 2 import pickle 3 import nester 4 man = [] 5 other = [] 6 try: 7 data = open ("datafile.txt") 8 9 for e... 阅读全文
posted @ 2014-06-18 11:07 galoishelley 阅读(328) 评论(0) 推荐(0)