how to read a string value as an integer in python? for eg if a=['1','2'] where 1 and 2 are characters. but these values are needed as integers for further operations like finding prime numbers between them
Here is the shortest answer,use the function int().
>>> i1=int( '1' )
>>> i1
1
>>> #Pass the character as subscript index of the list
>>> i2=int( a[0] )
>>> i2
1
P.S. your a=['1' , '2' ] is a list not string.For more conversion on different types.