User:Msiddalingaiah/Python snippets
Appearance
A short collection of Python code snippets
Main function
if __name__ == "__main__": main()
Command line arguments
import sys for arg in sys.argv: print arg
sys.argv[0] is the command, sys.argv[1] is the first argument proper.
Reading from a file
f = open('attach.rtf', 'rt') template = f.read() f.close()