OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How can I convert string values from a dictionary, into int/float datatypes?

  • Thread starter Thread starter siva
  • Start date Start date
S

siva

Guest
I have a list of dictionaries as follows:

Code:
list = [ { 'a':'1' , 'b':'2' , 'c':'3' }, { 'd':'4' , 'e':'5' , 'f':'6' } ]

How do I convert the values of each dictionary inside the list to int/float?

So it becomes:

Code:
list = [ { 'a':1 , 'b':2 , 'c':3 }, { 'd':4 , 'e':5 , 'f':6 } ]
<p>I have a list of dictionaries as follows:</p>
<pre><code>list = [ { 'a':'1' , 'b':'2' , 'c':'3' }, { 'd':'4' , 'e':'5' , 'f':'6' } ]
</code></pre>
<p>How do I convert the values of each dictionary inside the list to int/float?</p>
<p>So it becomes:</p>
<pre><code>list = [ { 'a':1 , 'b':2 , 'c':3 }, { 'd':4 , 'e':5 , 'f':6 } ]
</code></pre>
 

Latest posts

Top