Skip to content

Instantly share code, notes, and snippets.

@refo
refo / basic_file_read.py
Created January 10, 2019 11:30
Basic file reading, writing and argument operations in python
#!/usr/bin/env python2.7
import sys, os
fileName = sys.argv[1] if len(sys.argv) > 1 else "default"
cwd = os.getcwd()
path = os.path.join(cwd, "{}.txt".format(fileName))
print "File:"
print path