发布网友 发布时间:2022-04-25 15:13
共1个回答
热心网友 时间:2023-10-11 15:15
import
csv
def
values
():
reader
=
csv.reader(open("H:/python_study_data/1.txt",
"rb"),
delimiter
=
"\t")
for
row
in
reader:
chr,
start,
end
=
row[0],
int(row[1]),
int(row[2])
yield
(start,
end)
#return
改为yield生成器
def
main
():
for
start,
end
in
values():
aa
=
end-start
print
aa
if
__name__
==
'__main__':
main()