How to convert strings into integers in Python?

后端 未结 15 1907
自闭症患者
自闭症患者 2020-11-22 01:33

I have a tuple of tuples from a MySQL query like this:

T1 = ((\'13\', \'17\', \'18\', \'21\', \'32\'),
      (\'07\', \'11\', \'13\', \'14\', \'28\'),
               


        
15条回答
  •  遇见更好的自我
    2020-11-22 01:55

    T3=[]
    
    for i in range(0,len(T1)):
        T3.append([])
        for j in range(0,len(T1[i])):
            b=int(T1[i][j])
            T3[i].append(b)
    
    print T3
    

提交回复
热议问题