返回顶部

收藏

Open a file and read char by char

更多
file = open('test.txt', 'r')
print file.read()

while 1:
    char = file.read(1)          # read by character
    if not char: break
    print char,

file.close()

标签:Python,File

收藏

0人收藏

支持

0

反对

0

发表评论