fork download
  1. # your code goes here#Чтение из текстового файла
  2.  
  3. print(" ")
  4. text_file = open("read_it.txt", "r")
  5. text_file.close()
  6. print(" ")
  7. text_file = open("read_it.txt", "r")
  8. print(text_file.read(1))
  9. print(text_file.read(5))
  10. text_file.close
  11. print(" ")
  12. open("read_it.txt", "r")
  13. whole_thing = text_file.read()
  14. print(whole_thing)
  15. text_file.close()
  16. print(" ")
  17. text_file = open("read_it.txt", "r")
  18. print(text_file.readline(1))
  19. print(text_file.readline(5))
  20. text_file.close()
  21. print(" ")
  22. text_file = open("read_it_txt", "r")
  23. print(text_file.readline())
  24. print(text_file.readline())
  25. print(text_file.readline())
  26. text_file.close()
  27.  
  28. print(" ")
  29. text_file = open("read_it.txt", "r")
  30. for line in text_file:
  31. print(line)
  32. text_file.close()
  33. input("press enter")
  34.  
Runtime error #stdin #stdout #stderr 0.01s 8968KB
stdin
Standard input is empty
stdout
 
stderr
Traceback (most recent call last):
  File "prog.py", line 4, in <module>
IOError: [Errno 2] No such file or directory: 'read_it.txt'