### notes and log from lecture 16, 4/17/17, DS ### basic unix commands: ls - list files cd - change directory to cd .. - change to parent directory cd - change to home directory pwd - print working directory more - list contents of file one creenful at a time (hit space for next page) ### if you on a PC, type "cmd" in the program search bar, which will ### start a "terminal" under windows, running DOS ### some basic commands: DOS Unix equivalent dir ls cd cd cd C:\Users\schar cd /home/schar ### here is the log from interacting with the terminal: blackberry:~ schar$ cd Desktop blackberry:Desktop schar$ ls cs150 blackberry:Desktop schar$ cd cs150 blackberry:cs150 schar$ ls dogs.txt old lab7.py optional_parameters.py my_module.py optional_parameters_wrong.py my_module_user.py test.py blackberry:cs150 schar$ pwd /home/schar/Desktop/cs150 blackberry:cs150 schar$ cd .. blackberry:Desktop schar$ pwd /home/schar/Desktop blackberry:Desktop schar$ ls cs150 blackberry:Desktop schar$ cd cs150 blackberry:cs150 schar$ ls dogs.txt old lab7.py optional_parameters.py my_module.py optional_parameters_wrong.py my_module_user.py test.py blackberry:cs150 schar$ more test.py if __name__ == "__main__": print("This is a test, it is only a test.") else: print("This is a test of: " + __name__) blackberry:cs150 schar$ python Python 2.7.10 (default, Oct 23 2015, 19:19:21) [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 10/3 3 >>> ^D ### type Control-D to quit python blackberry:cs150 schar$ PATH=$PATH:/Applications/Spyder.app/Contents/Resources/middPython/bin/ blackberry:cs150 schar$ python3 Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 10/3 3.3333333333333335 >>> ^D blackberry:cs150 schar$ python3 test.py This is a test, it is only a test. blackberry:cs150 schar$ python3 Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import test This is a test of: test >>> import test >>> ^D blackberry:cs150 schar$ ls __pycache__ old dogs.txt optional_parameters.py lab7.py optional_parameters_wrong.py my_module.py test.py my_module_user.py blackberry:cs150 schar$ python3 test.py This is a test, it is only a test. blackberry:cs150 schar$ python3 test.py 05753 abd hello This is a test, it is only a test. blackberry:cs150 schar$ python3 sys_args.py Arguments: ['sys_args.py'] 0: sys_args.py blackberry:cs150 schar$ python3 sys_args.py abc 123 hello Arguments: ['sys_args.py', 'abc', '123', 'hello'] 0: sys_args.py 1: abc 2: 123 3: hello blackberry:cs150 schar$ python3 url_basics.py usage: python3 url_basics.py blackberry:cs150 schar$ python3 url_basics.py sdlghsdlkhgsd Please provide a valid URL as command-line argument blackberry:cs150 schar$ python3 url_basics.py http://www.cs.middlebury.edu/~schar/courses/cs150-s17/hw/prelab05.html CS 150 - Prelab 5

CS 150 - Prelab 5

Due: Friday 3/17 at the beginning of lab

Read the Lab 5 handout carefully so you are ready to start coding on Friday.

Find a partner if you want to work in a team. Your partner must be in the same lab section as you.

Nothing to hand in.


blackberry:cs150 schar$ python3 email_extractor.py wrote tutor-emails.txt blackberry:cs150 schar$ ls __pycache__ optional_parameters.py dogs.txt optional_parameters_wrong.py email_extractor.py sys_args.py lab7.py test.py my_module.py tutor-emails.txt my_module_user.py url_basics.py old blackberry:cs150 schar$ more tutor-emails.txt CS Tutor email addresses: aparker@middlebury.edu taow@middlebury.edu jachen@middlebury.edu [...]