<div>thanks,,,</div>  <div> </div>  <div>i tried another way and it works,,,</div>  <div> </div>  <div>f.writelines(','.join([('\"%s\"' % some[field]) for field in field_order]))<BR></div>  <div>thanks a lot,,,</div>  <div> </div>  <div><BR><B><I>Gabriel Genellina <gagsl-py2@yahoo.com.ar></I></B> wrote:</div>  <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">En Wed, 28 Feb 2007 08:34:29 -0300, kavitha thankaian <BR><KAVITHAPYTHON@YAHOO.CO.IN>escribió:<BR><BR>> thanks,,<BR>> now i have one more problem,,,<BR>> the strings should be seperated in an order,,,<BR>> some={1:'a', 2:7, 3:'c', 4:'d'}<BR>> i need the output to be a,c,d,7<BR>> before my code was:<BR>> field_order = [1,3,4,2]<BR>> for field in field_order:<BR>> f.writelines('\"%s\",' % someprt[field] )<BR>> do you have an idea now how should it look like???<BR><BR>Proceed in small steps. First get the data you need to
 write, then, format <BR>them and build a single line, then write the new line onto the file.<BR><BR>some = {1:'a', 2:7, 3:'c', 4:'d'}<BR># i need the output to be a,c,d,7<BR>field_order = [1,3,4,2]<BR>row = []<BR>for field in field_order:<BR>row.append(some[field])<BR># row contains ['a', 'c', 'd', 7]<BR># convert to string<BR>row = ['%s' % item for item in row]<BR>### alternative: convert to string, with "" around each value<BR>##row = ['"%s"' % item for item in row]<BR># make a single line, using "," as separator<BR>line = ','.join(row)<BR># write to file<BR>f.write('%s\n' % line)<BR><BR>-- <BR>Gabriel Genellina<BR><BR>-- <BR>http://mail.python.org/mailman/listinfo/python-list<BR></BLOCKQUOTE><BR><p>
        

        
                <hr size=1></hr> 
Here’s a new way to find what you're looking for - <a href="http://us.rd.yahoo.com/mail/in/yanswers/*http://in.answers.yahoo.com/">Yahoo! Answers</a>