
python
文章平均质量分 62
AI_machine_learning
这个作者很懒,什么都没留下…
展开
-
Mixing iteration and read methods would lose data
>>> f = open(r'c:\Movie\test.txt') >>> f.next() 'This is the first line\n' >>> f.next() ' Second line\n' >>> f.readline() Traceback (most recent call last): File "", line 1, in ValueError: Mixing i转载 2018-01-23 14:23:21 · 1624 阅读 · 0 评论 -
python return 的写法
def file2matrix(filename): fr = open(filename) numberOfLines = len(fr.readlines()) # get the number of lines in the file returnMat = zeros((numberOfLines, 3)) # prepare matrix to return原创 2018-01-24 17:57:33 · 1478 阅读 · 0 评论