files-9 - October 4 2010 CMSC143 - O'Hara 1 CMSC 143 Using...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: October 4 2010 CMSC143 - O'Hara 1 CMSC 143 Using Files Keith OHara kohara@bard.edu October 4 2010 CMSC143 - O'Hara 2 Announcements Etch-a-Sketch lab due tonight Next assignment Scribbler status Midterm Friday October 8 Review in class Wed March 6 Bring Questions! October 4 2010 CMSC143 - O'Hara 3 Midterm You and a pencil Closed Books Closed Notes Closed Laptops Closed Neighbors Closed Robot! 80 minutes Python Terminology Reading Programs Writing Programs Homework and Lab Material is Fair Game Topics Expressions Variables Functions For & While loops Conditionals Recursion Lists Objects October 4 2010 CMSC143 - O'Hara 4 October 4 2010 CMSC143 - O'Hara 5 Files HTML pages JPG files Python programs Organized hierarchically by directories or folders October 4 2010 CMSC143 - O'Hara 6 Memory in Computers Different levels of memory RAM (e.g. python variables) - fast and short term storage Files on disk (e.g. jpeg files) - slow and long term storage http://en.wikipedia.org/wiki/Memory_hierarchy October 4 2010 CMSC143 - O'Hara 7 Saving Data to a File Use files to save data Center light values from the robot f = open(test.txt, w) for i in range(25): turnRight(1, .2) c = getLight(center) f.write(str(c)) f.close() October 4 2010 CMSC143 - O'Hara 8 Opening Files 2 arguments Filename Current path or absolute path Mode: write(w) or read(r) Will overwrite existing files!...
View Full Document

Page1 / 22

files-9 - October 4 2010 CMSC143 - O'Hara 1 CMSC 143 Using...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online