How to convert numeric string from a sublist in Python

Solution 1:

You can do it like this:

list_samp = [['1','2','blue'],['1','66','green'],['1','88','purple']]
me = [[int(u) if u.isdecimal() else u for u in v] for v in list_samp]
print(me)