#!/usr/local/python3/bin/python3
# -*- coding: utf-8 -*
str1='a34e 345 bcd 5he 78 xyz'
#提取单个数字
for s in str1:
if s.isdigit():print (s)
#以空格分割的完整数字
for s in str1.split():
if s.isdigit():
print ((s))
网友回复
#!/usr/local/python3/bin/python3
# -*- coding: utf-8 -*
str1='a34e 345 bcd 5he 78 xyz'
#提取单个数字
for s in str1:
if s.isdigit():print (s)
#以空格分割的完整数字
for s in str1.split():
if s.isdigit():
print ((s))
网友回复