Answers for "function that separates element to string or int in python"

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

Code answers related to "function that separates element to string or int in python"

Python Answers by Framework

Browse Popular Code Answers by Language