或者,如果字符串中的数字是以特定分隔符(如空格、逗号等)分隔的,可以使用split()方法: python def extract_numbers(s): numbers = [] for sub in s.split(','): # 假设数字以逗号分隔 if sub.isdigit(): numbers.append(int(sub)) return numbers # 测试 s = "123,456,789" numbers = extract_numb...
number = '2 -99.0 -99.0 -99.0 -99.0 25.780703 0.2757377 25.349 0.303 23.819 0.051 22.765 0.031 22.258 0.028 21.976 0.035 22.164 0.036 22.011 0.047 -99.0 -99.0 -99.0 -99.0 ...