Opening a file and printing its contents line by line
Rather than using f.read().splitlines(), you can iterate the file object allowing you to use:

with open('&lt;filename&gt;') as f:
    for line in f:
        print line


Using with is better for various reasons, you don't have to remember to close the file, as you said in the question. It also closes the file, even if an error happened, which the second code doesn't. Take the following:

FILE_NAME = 'test_file.txt'
with open(FILE_NAME, 'w') as f:
    f.write('Hello World')

f = open(FILE_NAME)
try:
    with f:
        raise Exception()
        print f.read()
except Exception:
    try:
        print f.read()
    except ValueError:
        print 'I/O operation on closed file'

f = open(FILE_NAME)
try:
    raise Exception()
    print f.read()
except Exception:
    try:
        print f.read()
    except ValueError:
        print 'I/O operation on closed file'


f = open(FILE_NAME)
try:
    try:
        raise Exception()
        print f.read()
    finally:
        f.close()
except Exception:
    try:
        print f.read()
    except ValueError:
        print 'I/O operation on closed file'


This outputs two I/O error messages and one 'Hello World'. The single hello world is using the second way, without a finally to close the file. And so if you did want to use the second method, then you'd want to use something like:

try:
    f=open('&lt;filename&gt;')
    for line in f:
        print line
finally:
    f.close()


And, we all know which is easier to read an write.
For more information about the with statement you can look into PEP 343, which explains why it was added to Python.