Guest User

Untitled

a guest
Nov 19th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. import sys
  2.  
  3. filename = open("/Users/xxx/documents/python/dump.txt", 'r+')
  4.  
  5. filename.truncate()
  6.  
  7. sys.stdout = filename
  8.  
  9. print('Hello')
  10.  
  11. print('Testing')
  12.  
  13. filename.close()
  14.  
  15. with open("/Users/xxx/documents/python/dump.txt") as file:
  16. data = file.read()
  17. print(file)
  18.  
  19. import sys
  20.  
  21. filename = open('/media/elis/500/elis/workspace/so', 'w')
  22.  
  23. # filename.truncate() # mode 'w' truncates file
  24.  
  25. sys.stdout = filename
  26.  
  27. print('Hello')
  28.  
  29. print('Testing')
  30.  
  31. filename.close()
Add Comment
Please, Sign In to add comment