暖かくてぼんやりとした感じがしたい場合は、と一緒に行ってください。
Python 3.6の場合、私はこれら2つのプログラムをIDLEの新規開始時に実行し、以下のランタイムを提供しました。
0.002000093460083008  Test A
0.0020003318786621094 Test B: with guaranteed close
それほど大きな違いはありません。
#--------*---------*---------*---------*---------*---------*---------*---------*
# Desc: Test A for reading a text file line-by-line into a list
#--------*---------*---------*---------*---------*---------*---------*---------*
import sys
import time
#                                  # MAINLINE
if __name__ == '__main__':
    print("OK, starting program...")
    inTextFile = '/Users/Mike/Desktop/garbage.txt'
#                                  # Test: A: no 'with;
    c=[]
    start_time = time.time()
    c = open(inTextFile).read().splitlines()
    print("--- %s seconds ---" % (time.time() - start_time))
    print("OK, program execution has ended.")
    sys.exit()                     # END MAINLINE
出力:
OK, starting program...
--- 0.002000093460083008 seconds ---
OK, program execution has ended.
#--------*---------*---------*---------*---------*---------*---------*---------*
# Desc: Test B for reading a text file line-by-line into a list
#--------*---------*---------*---------*---------*---------*---------*---------*
import sys
import time
#                                  # MAINLINE
if __name__ == '__main__':
    print("OK, starting program...")
    inTextFile = '/Users/Mike/Desktop/garbage.txt'
#                                  # Test: B: using 'with'
    c=[]
    start_time = time.time()
    with open(inTextFile) as D: c = D.read().splitlines()
    print("--- %s seconds ---" % (time.time() - start_time))
    print("OK, program execution has ended.")
    sys.exit()                     # END MAINLINE
出力:
OK, starting program...
--- 0.0020003318786621094 seconds ---
OK, program execution has ended.