以下是一个示例的解决方法:
def read_number(s, i):
result = []
while i < len(s) and s[i].isdigit():
result.append(int(s[i]))
i += 1
return result
# 示例用法
s = "1234567890"
i = 0
numbers = read_number(s, i)
print(numbers) # 输出: [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
在这个解决方法中,我们使用了一个循环来遍历字符串s中的字符。在循环中,我们首先检查字符是否是数字,如果是数字则将其转换为整数并添加到结果列表中。然后,我们递增i的值以继续遍历下一个字符。当遇到一个非数字字符或达到字符串末尾时,循环结束并返回结果列表。