File Handling.

Slides:



Advertisements
Similar presentations
Introduction to File I/O How to read & write data to a disk file...
Advertisements

Contents Overview of the software - video How do I login? What are each of the tabs for? Manage Bookings Reports Manage Your Appointments Frequently Asked.
Why use Files? Your Python Program External File (secondary storage) Write to file (Save) Read from file (Load) …so we can have access to ‘stored’ data.
Course Registration Registration Procedures. Log-in through Intranet Portal.
HW 1: Problems 3 & 4 EC 1 & 2.
Main task -write me a program
2013.  Reconcile your checking account  Create bank reconciliation reports  Find errors during reconciliation  Correct errors found during reconciliation.
Textbook Management and the Insignia Library System.
How to Download and Install a Sharp Print Driver on a Mac.
Bringing your school online with Last Updated 6/1/2011.
A little PHP. Enter the simple HTML code seen below.
Python File Handling. In all the programs you have made so far when program is closed all the data is lost, but what if you want to keep the data to use.
Remember…  Please do not…  Change the background.  Change the icons.  Change the font. Use Times New Roman (size 12 font).  Use color. We cannot print.
Learning Targets  I can explain insulation and complete an insulation lab.
Dealing with Errors. Error Types Syntax Errors Runtime Errors Logical Errors.
Duty Log and Chat Setup SSG Frese, Jerome S. Sensor Manager Cell 12 MDD.
More While Loop Examples CS303E: Elements of Computers and Programming.
Friends = ['Tom', 'Sue', 'Danny', 'Joe', 'Mary'] Index positions >>>Friends[2] Danny >>>Friends[2:4] Danny, Joe >>>Friends[-4] Sue Use your PYTHON.
ISU Basic SAS commands Laboratory No. 1 Computer Techniques for Biological Research Animal Science 500 Ken Stalder, Professor Department of Animal Science.
Python Mini-Course University of Oklahoma Department of Psychology Day 2 – Lesson 7 Conditionals and Loops 4/18/09 Python Mini-Course: Day 2 - Lesson 7.
Count and add list of numbers From user input and from file.
File I/O Ruth Anderson UW CSE 160 Spring File Input and Output As a programmer, when would one use a file? As a programmer, what does one do with.
Make a dice challenge! This is a starter activity and should take 5 minutes [ slide 1 ] 1.Log in to your computer 2.Open IDLE 3.Copy the code below in.
Submitting Code Working > Not Working In almost all cases.
If the same piece of code needs to be used several times we can use a loop – but only if those times are all together. If you need to run the same bit.
File Handling in QBASIC
Training Guide Copy/Print. Log into Inside Augsburg.
Quick guide to ASIMON configuration For version 3.0 or greater SAFETY AT WORK Date: 3/18/2009.
Coding Time This is a starter activity and should take about 10 minutes [ slide 1 ] 1.Log in to your computer 2.Open IDLE 3.Start a script session (Select.
Python Lesson 1 1. Starter Create the following Excel spreadsheet and complete the calculations using formulae: 2 Add A1 and B1 A2 minus B2 A3 times B3.
Adviser Panel. Go to All DD Track Advisers: Click “Advisor Login”
File I/O Ruth Anderson UW CSE 140 Winter File Input and Output As a programmer, when would one use a file? As a programmer, what does one do with.
Sequential Processing to Update a File Please use speaker notes for additional information!
File Handle and conditional Lecture 2. File Handling The Files associated with Perl are often text files: e.g. text1.txt Files need to be “opened for.
Deanery/LETB Admin Guide. Logging in Click this button to be sent to the single sign on page. DO NOT use the local account log in below.
Downloading Procedures From the Web Importing Web Procedures Using ProEdit.
For Loop GCSE Computer Science – Python. For Loop The for loop iterates over the items in a sequence, which can be a string or a list (we will discuss.
Python focus – files The open keyword returns a file object Opening a file myFile = open('C:\file.txt', arg) Optional argument The second argument controls.
QUIZ MODULE. You can Add the quiz title or heading Select the to and form date for the quiz Description of quiz Prize being offered – If you have any.
Customizing the Quick Access Toolbar in Microsoft Office
Lesson 4 - Challenges.
Customer Online Ordering
Lesson 3 - Repetition.
Ruth Anderson UW CSE 160 Winter 2016
Click here to see your question
Ruth Anderson UW CSE 160 Winter 2017
Example Programs.
Python I/O.
Ruth Anderson UW CSE 160 Spring 2018
Use proper case (ie Caps for the beginnings of words)
More Loops.
Week 2 Computer Programming Learning Objective:
File Handling.
HOW TO CREATE A CLASS Steps:
Introduction to TouchDevelop
Superhero Quiz Year 9 Python.
How to save information in files open, write, close
Suppose I want to add all the even integers from 1 to 100 (inclusive)
Using screens and adding two numbers - addda.cbl
CSE Module 1 A Programming Primer
Small Basic Programming
Input and Output Python3 Beginner #3.
CSE 231 Lab 5.
GCSE Computing:: While Loops
Hint idea 2 Split into shorter tasks like this.
Copyright (c) 2017 by Dr. E. Horvath
What you need to do… Drag the pieces of code into the correct order like you can see in the EXAMPLE below. print ( “ int input ) = + Hello world chr ord.
Business PowerPoint Template
Executive Reports, Instructions and Documentation
Presenter Details Date
Presentation transcript:

File Handling

File Handling - #recap Procedure structure: def menu(): enter code for print, input, etc.. menu() #calls up code from above if not included code will not run #Remember it is good practice to include all procedures at the top of your code and then call them later.

Create a menu #Create a Menu using print (and an input) for the following: ****Film details**** 1…..Create to film file 2…..Read data from file 3…..Append film to file Please enter selection: _ #Use procedures for each option and an if elif to call the correct procedure depending on the user’s selection.

File Handling – writing to file ‘wt’ #writing to file, this should be in a procedure (e.g. def write file():) myFile = open(‘films.txt', 'wt') myFile.write (‘Star Wars\n') #add extra films here myFile.close()

File Handling – reading from file ‘rt’ #reading from file – use a procedure: #reading contents a line at a time myFile = open(‘films.txt', 'rt') for line in myFile: #for loop to read a line at a time print(line) myFile.close()

File Handling – appending to file ‘a’ #enter the code below in another procedure: myFile = open(“films.txt", "a") film = input(“Please enter name of film to append: ”) myFile.write(film) print(film, “has been added to the file”) myFile.close()