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
escribió:
> thanks,,
> now i have on
En Wed, 28 Feb 2007 08:34:29 -0300, kavitha thankaian
<[EMAIL PROTECTED]> escribió:
> thanks,,
> now i have one more problem,,,
> the strings should be seperated in an order,,,
> some={1:'a', 2:7, 3:'c', 4:'d'}
> i need the output to be a,c,d,7
> before my code was:
> field_or
thanks,,
now i have one more problem,,,
the strings should be seperated in an order,,,
some={1:'a', 2:7, 3:'c', 4:'d'}
i need the output to be a,c,d,7
before my code was:
field_order = [1,3,4,2]
for field in field_order:
f.writelines('\"%s\",' % someprt[f
Thanks Sanket,,,
But still doesnt solve my problem,,,
now my file contains:
aa,ba,b,ca,b,c, and so on,,,
the comma at the end is deleted,,,but the file contains some junk values,,,
kavitha
sanket kathalkar <[EMAIL PROTECTED]> wrote:
Solution to this problem is:
-
kavitha thankaian wrote:
> my script writes a dictionary to a file.but i need only the values
> from the dictionary which should be sepearted by a comma,,,so i did as
> following:
> [snip code that generates the incorrect original file]
> when i execute the above code,my test.txt file has the fol
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,,,so i did as following:
some=getAllData()-->dictionary
f=open("test.txt", "w")
for value in some.values():
f.writelines('\%s\,' % value )
kavitha thankaian wrote:
> i get an error when i try to delete in file and rename it as out
> file,,the error says
> "permission denied".
Perhaps you should give us both the exact code you are running and the
complete traceback of the error. That could make things easier. There
can be numerous re
i get an error when i try to delete in file and rename it as out file,,the
error says
"permission denied".
actually i need something like following:
in_file = open('in.txt','w')
for line in in_file:
line.strip().strip(',')
but when i run the above code,i get an error"bad fi
kavitha thankaian <[EMAIL PROTECTED]> wrote:
> and i need the output also in the same input.txt
just add
import os
os.remove('in.txt')
os.rename('out.txt', 'in.txt')
-
Don't be flakey. Get Yahoo! Mail for Mobile and
always stay connected to friends.--
http://m
the input file what i have is already opened with write mode.
say i have a file input.txt which has
a,b,c,d,
and i need the output also in the same input.txt,,ie., the trailing comma in
the input.txt file should be deleted,,,i dont need a file output.txt,,,
is there a way??
kavitha thankaian wrote:
> 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
..
I often use sed for such small
in_file = open('in.txt')
out_file = open('out.txt', 'w')
for line in in_file:
print >> out_file, line.strip(',')
kavitha thankaian <[EMAIL PROTECTED]> wrote: 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
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
-
Heres a new way to f
13 matches
Mail list logo