Answers for "how to separate a string into 2 lists of numbers and letters python"

-1

how to separate a string into 2 lists of numbers and letters python

stringtosplit = 'hello75world'
letters = []
numbers = []
for k in stringtosplit:
    if k.isalpha() == True:
        letters.append(k)
    elif k.isdigit() == True:
        numbers.append(k)
letters = ''.join(letters)
numbers = ''.join(numbers)
print(numbers)
print(letters)
Posted by: Guest on April-10-2021

Code answers related to "how to separate a string into 2 lists of numbers and letters python"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language