Any python programmers here?
I'm am (or was) a c programmer, but I want to learn python.
My goal is to leverage a python library I maintain (python-dfVFS).
I've just written my first python program and it actually works!
I wrote it in python 2.7, but I wonder if should skip straight to
learning python 3? The code base I want to call into is currently in
python 2.7, so I'm assuming that I should write my code in 2.7, but if
it is easy to call 2.7 code from 3.0, I think I'd rather do that.
Anyway, can someone one advise as to if I'm doing anything below in a
Here's my program. It reads a rather strange CSV file format and
converts it to a normal CSV. I've attached one line of the strange
CSV if someone actually wants to run this. (This is a real world
problem for me. I actually have several of these DAT files I need to
convert to standard CSV.)
from __future__ import print_function
charOld = ['"', '\xfe','\x14'] # find these...
charNew = ['""','"',','] # ...and replace with these
#-----Need some help?-------
print("Error: ", errMsg, file=sys.stderr)
print(sys.argv, " [input filename] [output filename]\n",
"NB: Output file will be created, overwriting any existing\n",
"file of the same name.", file=sys.stderr)
if len(sys.argv) < 3:
Usage('Arguments are required')
line = input.readline()
if not line:
Should I have the equivalent of main()?
Should I have an exit at the bottom of the file?
fyi: The next step is to accept multiple input files, concatenate them
while stripping the header from all but the first file, and output the
result to a single integrated file.