Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- filename = open("/Users/xxx/documents/python/dump.txt", 'r+')
- filename.truncate()
- sys.stdout = filename
- print('Hello')
- print('Testing')
- filename.close()
- with open("/Users/xxx/documents/python/dump.txt") as file:
- data = file.read()
- print(file)
- import sys
- filename = open('/media/elis/500/elis/workspace/so', 'w')
- # filename.truncate() # mode 'w' truncates file
- sys.stdout = filename
- print('Hello')
- print('Testing')
- filename.close()
Add Comment
Please, Sign In to add comment