Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. # write
  2. todos_file = open("todos.txt", "wb")
  3. todos_file.write(bytes("buy a new domain name\n", "UTF-8"))
  4. todos_file.write(bytes("work on the side project\n", "UTF-8"))
  5. todos_file.write(bytes("learn a new programming language\n", "UTF-8"))
  6. todos_file.close()
  7.  
  8. # read
  9. todos_file = open("todos.txt", "r+")
  10. todos_file_contents = todos_file.read()
  11. print(todos_file_contents)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement