Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. import sys
  2. print('###################################Genarating Global Variables##########################')
  3. storage_file = open("Storage-output.txt", 'w')
  4. sys.stdout = storage_file
  5. print ('whatever')
  6. storage_file.close()
  7.  
  8. import sys
  9. print('###################################Genarating Global Variables##########################')
  10. storage_file = open("Storage-output.txt", 'w')
  11. sys.stdout = storage_file
  12. print ('what')
  13. storage_file.close()
  14. print('Completed Global variables creation')
  15.  
  16. import sys
  17.  
  18. print('###################################Genarating Global Variables##########################')
  19. stdout = sys.stdout
  20. with open("Storage-output.txt", 'w') as storage_file:
  21. sys.stdout = storage_file
  22. print ('what')
  23. sys.stdout = stdout
  24. print('Completed Global variables creation')
  25.  
  26. import sys
  27. print('###################################Genarating Global Variables##########################')
  28. storage_file = open("Storage-output.txt", 'w')
  29. sys.stdout = storage_file
  30. print ('what')
  31. storage_file.close()
  32. sys.stdout = sys.__stdout__ # return to its original value as stated in https://docs.python.org/2/library/sys.html#sys.__stdout__
  33. print('Completed Global variables creation')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement