How to eliminate quotes around string field written to a file.

len lsumnler at
Sat Nov 15 05:39:53 CET 2008


Have this code in my program;

    filename = 'custfile'
    codeline = filename + ' = [\n'

record written to file look like this

     "custfile" = [

Yet in another part of the program I have code:

     def fmtline(fieldline):
         code = '(' + fieldline[1].replace('-', '_').replace('.',
'').lower() + \
          ', ' + fieldline[3] + '),\n'
          return code

fieldline is a list of which the first item in the list is a fieldname

record written to file looks like this, no quotes

    (customer_no, X(6).),
    (customer_name, X(30).),
    (customer_street_1, X(30).),
    (customer_street_2, X(30).),
    (customer_city, X(15).),

Why quotes  in the first case and not the second and how do I get read
of the quotes
in the first case.

Len Sumnle

More information about the Python-list mailing list