Presentation is loading. Please wait.

Presentation is loading. Please wait.

Python 16 Mr. Husch.

Similar presentations


Presentation on theme: "Python 16 Mr. Husch."— Presentation transcript:

1 Python 16 Mr. Husch

2 Aim Students will gain a list of commands that should be used other than open for reading and writing files.

3 What commands do you already know? Here are new commands.
close -- Closes the file. Like File->Save.. in your editor. read -- Reads the contents of the file, you can assign the result to a variable. readline -- Reads just one line of a text file. truncate -- Empties the file, watch out if you care about the file. write(stuff) -- Writes stuff to the file.

4 Save as lastname16

5 Test run To run the program you need to open it in the CMD.
After you find the file to run it you will need to type in Python lastname16.py yourname

6 Additions to make before turning in.
1) Place one comment line on each section of code to better understand what is occurring 2) See if you can streamline the file by using strings, formats, and escapes in line1, line2, and line3 with just one target.write commands

7 16.2 Now you need to see if you can really alter a file with another file. You will need to first make a simple file that prints out one or two lines. Then you will need to make the new file that you can use to alter this first one like in the example.


Download ppt "Python 16 Mr. Husch."

Similar presentations


Ads by Google