lec-10-26

lec-10-26 - 10/26/2009 Whats happening Program 4 due...

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

View Full Document Right Arrow Icon
10/26/2009 1 ECS 10 10/26 What’s happening ± Program 4 due tomorrow. ± Next assignment takes two weeks. ± Hand in part A in week 1, part B in week 2. Combine data from two sources make a map ± Combine data from two sources, make a map. ± Energy sources in the US, per capita. ± Today: files. Access files through variables ± Get access to the file: inFile = open(”statePopulations.txt”, “r”) outFile = open(”EnergySources.txt”, “w”) variable to refer to file name of file read – it's an input file; similarly w for write, i.e., an output file File type data ± File is a new data type. ± Mostly use it with file methods. ± Variables are in your computer’s memory. Files are on disk are on disk. ± Variables disappear when your program ends. Files let you keep things. Reading a file ± You can treat a file just like a list of lines. ± Each line is a string, ending in a newline character. for line in inFile:
Background image of page 1

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

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

This note was uploaded on 01/14/2010 for the course ECS 10 taught by Professor Amenta during the Spring '07 term at UC Davis.

Page1 / 3

lec-10-26 - 10/26/2009 Whats happening Program 4 due...

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

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