Skip to content

Python code snippet – 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)
See also  Python code snippet - How to read excel with multiple pages on pandas?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.