String to char and decimal number conversion

SANKAR . shankarphy at gmail.com
Tue Jan 11 00:50:22 EST 2011


Thanks Alan!

-Sankar

On Tue, Jan 11, 2011 at 2:50 PM, Alan Meyer <ameyer2 at yahoo.com> wrote:

> On 1/10/2011 6:02 PM, Chris Rebert wrote:
>
>> On Mon, Jan 10, 2011 at 2:44 PM, SANKAR .<shankarphy 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 ']
>>>
>>
> This will do it:
> ------------------------------------------------
>
> T1 = [ ' "Field" ' , ' "12.5" ', ' "2.5" ']
> T2 = []
> for t in T1:
>    T2.append(t.replace('"', ''))
> ------------------------------------------------
>
> The "replace" function acts on each element in T1, replacing every double
> quote with nothing.  We then append that to the new list T2.
>
>    Alan
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110111/e5ac8b03/attachment-0001.html>


More information about the Python-list mailing list