Python Forum

Full Version: Issue with reading CSV file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
If the file's content is that simple, you can perhaps parse it yourself without the csv module
with open(datafile) as infile:
    for line in infile:
        row = [x.strip() for x in line.split(',', 1)]
        # do something with the row
But i need to add few words with in the lines like
Input line Column1 Number(10,2)
convert to
CAST (Column1 as NUMBER(10,2)) as Column1
You can use
c, n = row
s = "CAST ({c} as {n}) as {c}".format(c=c.capitalize(), n=n.upper())
Pages: 1 2