Answers for "python extract numbers from a list of strings"

1

how to seperate words and number in a list

ip=['a',1,2,3]
m=[]
n=[]
for x in range(0,len(ip):
    if str(ip[x]).isdigit():
        m.append(ip[x])
    else:n.append(ip[x])
print(m,n)
Posted by: Guest on August-03-2020
0

extract numbers from list of strings python using regex

new_list = [int(item) for sublist in a for item in sublist if item.isdigit()]
Posted by: Guest on October-05-2020

Code answers related to "python extract numbers from a list of strings"

Python Answers by Framework

Browse Popular Code Answers by Language