Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24) [Clang 6.0 (clang-600.0.57)] on darwin Type "copyright", "credits" or "license()" for more information. >>> mf = open("/Users/koc/Desktop/abc.txt", "r") >>> mf <_io.TextIOWrapper name='/Users/koc/Desktop/abc.txt' mode='r' encoding='UTF-8'> >>> mx = open("/Users/koc/Desktop/def.txt", "r") Traceback (most recent call last): File "", line 1, in mx = open("/Users/koc/Desktop/def.txt", "r") FileNotFoundError: [Errno 2] No such file or directory: '/Users/koc/Desktop/def.txt' >>> mf <_io.TextIOWrapper name='/Users/koc/Desktop/abc.txt' mode='r' encoding='UTF-8'> >>> s1 = mf.readline() >>> s1 'amy 23\n' >>> s2 = mf.readline() >>> s2 'bob 22\n' >>> mf = open("/Users/koc/Desktop/abc.txt", "r") >>> s1 'amy 23\n' >>> x1 = s1.split() >>> s1 'amy 23\n' >>> x1 ['amy', '23'] >>> mf = open("/Users/koc/Desktop/abc.txt", "r") >>> names = [] >>> ages = [] >>> for s in mf: x = s.split() names.append(x[0]) ages.append(x[1]) >>> names ['amy', 'bob', 'alice', 'steve', 'laurie'] >>> ages ['23', '22', '19', '20', '19'] >>> mf = open("/Users/koc/Desktop/abc.txt", "r") >>> names = [] >>> ages = [] >>> for s in mf: x = s.split() names.append(x[0]) ages.append(int(x[1])) >>> names ['amy', 'bob', 'alice', 'steve', 'laurie'] >>> ages [23, 22, 19, 20, 19] >>>