You may need to refer to this week's reading assignment throughout the exercises. 


Announcements

  • We are almost done with the most important Python basics.  Soon we will start to apply them while learning some data-science tools. 

IMPORTANT:  The Rivanna Support Team has created a special OnDemand instance just for us.  Please use it today for your session and let me know if you see any network issues:

https://ood1.hpc.virginia.edu/pun/sys/dashboard/

Goals

  • Learn about reading and writing to files

0) Get the GitHub repository and clone it to your area in Rivanna. 


Use this link to accept the assignment and create your repository: https://classroom.github.com/a/jO3AjzFL


After you accept the assignment and the repository and it exists in your GitHub, clone it to your Rivanna working area.

1) File Input/Output


1a) Work through the Class10.ipynb Jupyter Notebook.   Thinking about what is happening in each step and completing the exercises!



1b)  If time is remaining write a Python program (a script) called <username>_read_write.py that takes a filename as a command line input (argv[1], remember!) reads the information the file, and then creates a file data.csv where you write the same information in csv (comma-separated values) format.  Your program should politely tell the user if the input file does not exist (not crash!).  Rename your data file and make sure your program still works.  Write a second program read_csv.py that reads your csv file. 



Done?  Add some documentation to your programs, and push them to your GitHub repository:    read_write.py, read_csv.py, and class10.ipynb . 


  • No labels