понедельник, 20 апреля 2015 г.

Вывод из файла / Input from file

Доброе утро, я давно не писал ничего так как был приступ лени, выходные выбили меня из колеи и мне тяжело было вернуться.

Сегодня я дописал вывод информации из файла к калькулятору из предыдущей статьи (Калькулятор),  сам по себе вывод очень прост, сначала делаем открытие файла на чтение после с помощью for считываем строки из файла и печатаем на экран.


Если вы меня читаете напишите пожалуйста в комментариях, что еще добавить к калькулятору ??


/


Good morning, I have not written anything since had an attack of laziness, weekend knocked me off balance and it was hard to go back.

Today I finished the withdrawal of the information from the file to the calculator from the previous article (Calculator), by itself, the conclusion is very simple, first make opening the file for reading after using for read lines from file and print to the screen.

If you read me please write in the comments what else to add to the calculator ??




# -*- coding: utf-8 -*- #Выставляем кодировку / Set the encoding

FILE_NAME = 'data.txt'  #Присваиваем переменной название файла с результатами /
                        #Assign to the variable the name of the results file
def printfile():
    file_print = open (FILE_NAME,'r') #Открываем на чтение / Opened for reading
    for line in file_print:   #Считываем строки из файла / Read lines from file
        print (line)   #Печатаем на экран / Printed on the screen
    file_print.close() #Закрываем сессию / Close the session

Комментариев нет:

Отправить комментарий