writing dictionary to file
jim-on-linux
inq1ltd at verizon.net
Thu Mar 8 20:03:13 EST 2007
On Thursday 08 March 2007 14:40, kavitha thankaian
wrote:
> Hi Simon,
>
> iam till here:
>
> dorc=some['DorC']
> amount=some['amount']
> f=open("logfile.txt", "w")
> if dorc =='C':
> a = -(amount)
> if dorc == 'D':
> b = amount
> sum=a + b
> if sum == 0:
> f.writelines("name:")
> f.writelines("%s" %some['name'])
> f.writelines("credit:")
> f.writelines("%s" % amount)
>
> but i see an empty file opened,,,
>
> kavitha
>
> Simon Brunning <simon at brunningonline.net>
> wrote:
>
> On 3/8/07, kavitha thankaian wrote:
> > can anyone help me???
>
> I'm sure we can. How far have you got so far?
try
f=open("logfile.txt", "w")
f.write('name')
f.write('\n')
f.write(('credit(')
f:close()
jim-on-linux
http:\\www.inqvista.com
More information about the Python-list
mailing list