We are to write the letters of a given string S, from left to right into lines. Each line has maximum width 100 units, and if writing a letter would cause the width of the line to exceed 100 units, it is written on the next line. We are given an arra
We are to write the letters of a given string S, from left to right into lines. Each line has maximum width 100 units, and if writing a letter would cause the width of the line to exceed 100 units, it is written on the next line. We are given an arra
文件 readlines 列表 readline 字符串 read 字符串 列表---拆分---小列表 f=file('test.log','r') for line in f.readlines(): print line.strip('\n').split(':') 字符串 l='a:b:c:d' l.split(':') ['a', 'b', 'c', 'd'] 打印文件第一列: for i in f.readlines(): print i.split(':')[0] f