from solution import FileReader reader = FileReader('not_exist_file.txt') print(reader.__dict__) text = reader.read() print(text) with open('some_file.txt', 'w') as file: file.write('some text') reader = FileReader('some_file.txt') text = reader.read() print(text) print(type(reader))
def read(filename): reader = FileReader(filename) text = reader.read() print(f"{filename} contains: '{text}'") print(type(reader))
def _main(): file = sys.argv[1] reader = FileReader("example.txt") print(reader.read())
from solution import FileReader if __name__ == "__main__": reader = FileReader("not_exist_file.txt") text = reader.read() assert text == "" with open("hello.txt", "w") as f: f.write("Hello, World!") reader = FileReader("hello.txt") text = reader.read() assert text == "Hello, World!"
from solution import FileReader if __name__ == '__main__': pth = input('Введите путь до файла: \n') file = FileReader(pth) print(file.read())
from solution import FileReader reader = FileReader('data_storage.py') print(reader.read())
from solution import FileReader reader = FileReader("some_path") content = reader.read() print(content)
from solution import FileReader reader = FileReader('file/not/found/') print(reader.read()) reader = FileReader('../week2/storage.py') print(reader.read())
def _main(): reader = FileReader('example.txt') print(reader.read())
from solution import FileReader reader = FileReader('not_sfda.txt') text = reader.read() print(text)