Python
imarch1
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
6 Lessons From Dropbox - One Million Files Saved Every 15 Minutes
Dropbox saves one million files every 15 minutes, more tweets than even Twitterers tweet. That mind blowing statistic was revealed by Ria转载 2011-09-01 12:51:47 · 404 阅读 · 0 评论 -
range 与 xrange 的区别
在 Python 中,range 和 xrange 均可以用来做迭代的范围,不过 range 返回的是 list,而 xrange 则返回一个 xrange object。 for x in range(1000): will generate a list原创 2011-09-03 15:04:04 · 422 阅读 · 0 评论 -
读取大文件
通常读取文件的方法是: for line in open('myfile','r').readlines() 但问题是会将整个文件读入内存,所以对于大文件此方法不适合。 下面的方法会一行一行地读取文件: import fileinput for lin原创 2011-09-06 15:08:24 · 244 阅读 · 0 评论 -
操作系统的判断
import os; if os.name == "nt": # windows blabla; elif os.name == "posix": # linux blabla;原创 2011-12-04 17:17:53 · 577 阅读 · 0 评论 -
不同操作系统中的换行符
Windows: \n Linux: \r\n Unix: \r原创 2011-12-04 17:13:41 · 671 阅读 · 2 评论 -
字典的遍历
for i in xrange(0, len(dict)): key = dict.keys()[i]; # key 是第i个索引原创 2011-12-04 17:16:00 · 301 阅读 · 0 评论 -
字符与数字的相互转化
str(num); # 将数字转化位字符串 import string; string.atoi(str); # 将字符串转化位整数 string.atof(str); # 将字符串转化位小数原创 2011-12-05 17:21:55 · 387 阅读 · 0 评论
分享