Advertisement
Guest User

Untitled

a guest
Apr 28th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. # python3
  2. def read_file():
  3. with open('input.txt', 'rt') as f:
  4. print(f.read())
  5.  
  6.  
  7. def read_lines():
  8. with open('input.txt', 'rt') as f:
  9. for line in f:
  10. print(line)
  11.  
  12.  
  13. def write_file():
  14. with open('output.txt', 'w') as f:
  15. f.write('Hi there\n')
  16. f.write('Second line\n')
  17. f.close()
  18.  
  19.  
  20. read_file()
  21. read_lines()
  22. write_file()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement