? One of the simplest ways of getting data into a program is to ask the user a question, let the user type in an answer, and then read the text in that answer into a variable in the program. ? These tasks are done by calling a function with name raw_input in Python 2 - the name is just input in Python 3. ? Variable = raw_input “Ask question here”
? Getting input data into a program from questions and answers, works for small amounts of data. ? ? ? Otherwise, input data must be available in files.
?In windows O.S. we can use ( NotePad file ) or (Microsoft word ) as file resource . ? ? ? Suppose we have recorded some measurement data in the file? ? Python .txt
* to reading a file, We first need to open the file, This action creates a file object. ? Variable = open (’File name .txt’ , ’mode’)
? After the file is read, one should close the file object with? Read_file.close().
*The basic technique for reading the file line by line is done using? File object . readline()
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
|