String to char and decimal number conversion

Davish Bhardwaj davishbhardwaj1986 at gmail.com
Tue Jan 11 05:41:50 EST 2011


On Jan 11, 4:02 am, Chris Rebert <c... at rebertia.com> wrote:
> On Mon, Jan 10, 2011 at 2:44 PM, SANKAR . <shankar... at gmail.com> wrote:
> > Hello There,
>
> >        I am from non IT field also new to python programming.Could you
> > please help me to solve the following problem?
>
> > I have a list T1 with following format:
>
> > T1 = [ ' "Field" ' , ' "12.5" ', ' "2.5" ']
>
> > How do get the list elements without double quote in my output (T2).
>
> > T2 =[ ' Field ' , ' 12.5 ', ' 2.5 ']
>
> How are you obtaining T1 in the first place?
>
> Cheers,
> Chris
> --http://blog.rebertia.com


You can also do it like :
T1 = [ ' "Field" ' , ' "12.5" ', ' "2.5" ']
T2 = [t.replace('"', '') for t in T1]

This seems to me a more better and fast code ;)


Davish




More information about the Python-list mailing list