Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> [1, 2, 3] [1, 2, 3] >>> (1, 2, 3) (1, 2, 3) >>> 1, 2, 3 (1, 2, 3) >>> ================================ RESTART ================================ >>> The contents are: >>> fout.close() >>> fin.close() >>> ================================ RESTART ================================ >>> The contents are: >>> ================================ RESTART ================================ >>> The contents are: >>> ================================ RESTART ================================ >>> The contents are: asdf >>> ================================ RESTART ================================ >>> Traceback (most recent call last): File "C:/Users/mil28/Desktop/missing_file.py", line 1, in fin = open('missing_file.txt', 'r') FileNotFoundError: [Errno 2] No such file or directory: 'missing_file.txt' >>> import os.path >>> type(os.path) >>> from sys import exit >>> from os.path import exists >>> exists('missing_file.txt') False >>> exists('tmp.txt') True >>> os.getcwd() 'C:\\Users\\mil28\\Desktop' >>> print('\ttext') text >>> print('C:\Users\mil28\Desktop') SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape >>> print('C:\\Users\\mil28\\Desktop') C:\Users\mil28\Desktop >>> fin = open('C:\\Users\\mil28\\Desktop\\tmp.txt', 'r') >>> print(fin.read()) asdf >>> fin.close() >>> fin = open('C:/Users/mil28/Desktop/tmp.txt', 'r') >>> fin.read() 'asdf' >>> fin.close() >>> os.path.join('C:', 'Users', 'mil28', 'Desktop', 'tmp.txt') 'C:Users\\mil28\\Desktop\\tmp.txt' >>> filename = os.path.join('C:', 'Users', 'mil28', 'Desktop', 'tmp.txt') >>> fin = open(filename, 'r') Traceback (most recent call last): File "", line 1, in fin = open(filename, 'r') FileNotFoundError: [Errno 2] No such file or directory: 'C:Users\\mil28\\Desktop\\tmp.txt' >>> os.path.join('C:\\', 'Users', 'mil28', 'Desktop', 'tmp.txt') 'C:\\Users\\mil28\\Desktop\\tmp.txt' >>> fout= open("new file.txt", 'w') >>> fout.write('asdfvcaeaers') 12 >>> fout.close() >>> ================================ RESTART ================================ >>> >>> ================================ RESTART ================================ >>> >>> ================================ RESTART ================================ >>> >>> os.getcwd() Traceback (most recent call last): File "", line 1, in os.getcwd() NameError: name 'os' is not defined >>> import os >>> os.getcwd() 'C:\\Users\\mil28\\Desktop\\Project\\src' >>> os.setcwd('C:\\Users\\mil28\\Desktop') Traceback (most recent call last): File "", line 1, in os.setcwd('C:\\Users\\mil28\\Desktop') AttributeError: 'module' object has no attribute 'setcwd' >>> ================================ RESTART ================================ >>> The contents are: asdf >>> fin = open('tmp.txt', 'r') >>> fin.read() 'asdf' >>> fin.close() >>> fin = open('tmp', 'r') Traceback (most recent call last): File "", line 1, in fin = open('tmp', 'r') FileNotFoundError: [Errno 2] No such file or directory: 'tmp' >>> os.getcwd() Traceback (most recent call last): File "", line 1, in os.getcwd() NameError: name 'os' is not defined >>> import os >>> os.getcwd() 'C:\\Users\\mil28\\Desktop' >>> ================================ RESTART ================================ >>> >>> ================================ RESTART ================================ >>> Alice 10/24/86 red >>> print('asdf') asdf >>> print('asdf'\n') SyntaxError: unexpected character after line continuation character >>> print('asdf\n') asdf >>> ================================ RESTART ================================ >>> Alice 10/24/86 red  >>> ================================ RESTART ================================ >>> ['Alice', '10/24/86', 'red\n'] >>> ================================ RESTART ================================ >>> Traceback (most recent call last): File "C:/Users/mil28/Desktop/reading_example.py", line 3, in line = line.split('') ValueError: empty separator >>> ================================ RESTART ================================ >>> ['Alice', '10/24/86', 'red'] >>> ================================ RESTART ================================ >>> >>> ================================ RESTART ================================ >>> ['Alice', 'Jones', '10/24/86', 'red'] >>> ================================ RESTART ================================ >>> ['Alice Jones', '10/24/86', 'red\n'] >>> ================================ RESTART ================================ >>> ['Alice Jones', '10/24/86', 'red'] >>> ================================ RESTART ================================ >>> ['Alice Jones', '10/24/86', 'red'] >>> ================================ RESTART ================================ >>> ['Alice Jones', '10/24/86', 'red'] ['Bob', '3/14/90', 'green'] ['Carol', '7/14/80', 'blue'] >>> ================================ RESTART ================================ >>> ['Alice Jones\t10/24/86\tred\n', 'Bob\t3/14/90\tgreen\n', 'Carol\t7/14/80\tblue\n'] >>>