1. Introduction
Thus far in this lectures, we have seen examples of programs that have taken input data from users at the keyboard. Most of these programs can receive their input from files as well. A file is a software object that stores data on a permanent medium such as a disk, CD, or flash memory. When compared to keyboard input from a human user, the main advantages of taking input data from a file are the following: • The data set can be much larger. • The data can be input much more quickly and with less chance of error. • The data can be used repeatedly with the same program or with different programs.
2. Files and Their Format Using a text editor such as Notepad or TextEdit, you can create, view, and save data in a file. Your Python programs can output data to a text file, a procedure explained later in this section. The data in a file can be viewed as characters, words, numbers, or lines of text, depending on the file’s format and on the purposes for which the data are used. When the data are treated as numbers (either integers or floating-points), they must be separated by white- space characters—spaces, tabs, and newlines.
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
|