Reading a file in python via read()
Consider this snippet
from sys import argv
script, input_file = argv
def print_all(f):
print f.read()
current_file = open(input_file)
print_all(current_file)
Ref. line 4: Why do I have to use "print" along with "f.read()". When I
use just f.read() it doesnt print anything, why ?
No comments:
Post a Comment