自分用メモ
全部読みたいとき
def read_file(filepath): with open(filepath, 'r') as stream: contents = stream.read() print contents
1行ずつ
def read_file(filepath): with open(filepath, 'r') as stream: for line in stream: print line
自分用メモ
def read_file(filepath): with open(filepath, 'r') as stream: contents = stream.read() print contents
def read_file(filepath): with open(filepath, 'r') as stream: for line in stream: print line