writing dictionaries to a file

2007-03-21 Thread kavitha thankaian
Hi All, I have two dictionaries: somex:{'unit':00, type:'processing'} somey:{'comment':'fair', 'code':'aaa'} somey:{'comment':'good', 'code':bbb'} somey:{'comment':'excellent', 'code':'ccc'} now i would like to write this to a file in the following format(unit, code

Re: writing dictionary to file

2007-03-08 Thread kavitha thankaian
;) f.writelines("%s" %some['name']) f.writelines("credit:") f.writelines("%s" % amount) but i see an empty file opened,,, kavitha Simon Brunning <[EMAIL PROTECTED]> wrote: On 3/8/07, kavitha thankaian wrote

writing dictionary to file

2007-03-08 Thread kavitha thankaian
Hi, I have 'n' number of dictionaries with the same name but different values ( DorC means debit or credit) some={'DorC':'D', 'amount':200,'name':'xxx'} some={'DorC':'C', 'amount':200,'name':'xxx'} some={'DorC':'D', 'amount':300,'name':'yyy'} some={'DorC':'C', 'amount':500,

Re: newbie question(file-delete trailing comma)

2007-03-01 Thread kavitha thankaian
thanks,,, i tried another way and it works,,, f.writelines(','.join([('\"%s\"' % some[field]) for field in field_order])) thanks a lot,,, Gabriel Genellina <[EMAIL PROTECTED]> wrote: En Wed, 28 Feb 2007 08:34:29 -0300, kavitha thankaian

Re: newbie question(file-delete trailing comma)

2007-02-28 Thread kavitha thankaian
writelines('\"%s\",' % someprt[field] ) do you have an idea now how should it look like??? Mikael Olofsson <[EMAIL PROTECTED]> wrote: kavitha thankaian wrote: > my script writes a dictionary to a file.but i need only the values > from the

Re: newbie question(file-delete trailing comma)

2007-02-28 Thread kavitha thankaian
tmpstr.strip(","))>strings seperated by comma ----------- Thanks sanket kavitha thankaian wrote: > ok,,, > my script writes a dictionary to a file.but i need only the values > from the dictionary which should be sepearted by a comma,,,

Re: newbie question(file-delete trailing comma)

2007-02-28 Thread kavitha thankaian
telines('\%s\,' % value )>strings seperated by comma when i execute the above code,my test.txt file has the following: a,b,c,d, now i need to delete the comma at the end,,,this is my problem,,, kavitha Mikael Olofsson <[EMAIL PROTECTED]

Re: newbie question(file-delete trailing comma)

2007-02-27 Thread kavitha thankaian
i run the above code,i get an error"bad file descriptor" thanks,, kavitha Mohammad Tayseer <[EMAIL PROTECTED]> wrote: kavitha thankaian <[EMAIL PROTECTED]> wrote: > and i need the output also in the same input.txt jus

Re: newbie question(file-delete trailing comma)

2007-02-26 Thread kavitha thankaian
ill remove the ',' char from the beginning & end of the string, not the middle. empty strip() will remove whitespaces from the beginning & end of the string I hope this solves your problem kavitha thankaian <[EMAIL PROTECTED]> wrote:hi i would like to have the ou

newbie question(file-delete trailing comma)

2007-02-26 Thread kavitha thankaian
hi, i have a file which has the contents as follows: a,b,c,d, a1,b1,c1,d1, a2,b2,c2,d2, i would like to delete all the trailing commas,, if someoneknows pls help me,, kavitha - Here’s a new way to f

Re: writing a file:newbie question

2007-02-26 Thread kavitha thankaian
a,b,c,d, i would like to delete the trailing comma at the end,,, if someone knows pls write to me,,, kavitha Gabriel Genellina <[EMAIL PROTECTED]> wrote: En Mon, 19 Feb 2007 08:02:29 -0300, kavitha thankaian escribió: > Hi, > i have a file test.txt and it contai

writing a file:newbie question

2007-02-19 Thread kavitha thankaian
Hi, i have a file test.txt and it contains a list of strings say,,, "a","b","c","d","a1","b1","c1","d1","a2","b2","c2","d2", i would like to write the file as "a","b","c","d" "a1","b1","c1","d1 "a2","b2","c2","d2" and would like to delete the comma at the end.

list of strings-newline

2007-02-15 Thread kavitha thankaian
Hi i have a list as follows list="a1,b1,c1,d1,a2,b2,c2,d2,a3,b3,c3,d3, I would like to print as a1,b1,c1,d1, a2,b2,c2,d2, a3,b3,c3,d3, and then i would like to delete the comma at the end,,say like,, a1,b1,c1,d1 a2,b2,c2,d2 a3,b3,c3,d3 (its always

Re: newbie question:connecting to a database

2007-01-25 Thread kavitha thankaian
,,, Kavitha Eugene Antimirov <[EMAIL PROTECTED]> wrote: kavitha thankaian wrote: > Hi, > > i wrote a simple script (which follows) to insert a table in the > database.i could execute this query and get the result in python > shell.but when i open "my sql enterprise m

Re: newbie question

2007-01-23 Thread kavitha thankaian
Hi Eugene, I tried with conn.commit() as well,,but doesnt seem to work. Also i cannot even view the existing tables via python script.For example,,,i have manually added a customer table in my database.but if i execute the query, select * from customer,,,i get the following error: m

newbie question

2007-01-22 Thread kavitha thankaian
Hi, i wrote a simple script (which follows) to insert a table in the database.i could execute this query and get the result in python shell.but when i open "my sql enterprise manager" i couldnt find the table"animals".it would be so kind of you if someone could help me,,, import