📜  如何将字符串分成 2 个数字和字母列表 python - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:33.009000             🧑  作者: Mango

代码示例1
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)