我有一个包含数字和字符串的文件,该文件如下所示:
你知道吗示例.txt你知道吗
100
no of benches = 40
no of lights=160
400
700
我尝试使用string.atoi
来分隔数字,但未能获得输出。这是我的密码:
import string
file = open('sample.txt')
numbers = file.readline()
k= string.atoi(numbers)
print(k)
是否有任何特定的模块或命令来执行此任务?你知道吗
Tags:
它可以很容易地由正则表达式检索
相关问题 更多 >
编程相关推荐