Created
May 22, 2013 12:22
-
-
Save khajavi/5627147 to your computer and use it in GitHub Desktop.
redirect io to file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
orig_stdout = sys.stdout | |
f = open('out.txt', 'w') | |
sys.stdout = f | |
alphabets = "qwertyuiopasdfghjklzxcvbnm" | |
codes = [ x + y + z for x in alphabets for y in alphabets for z in alphabets ] | |
for item in codes: | |
print( item ) | |
sys.stdout = orig_stdout | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment