python 遍历问题
bk=10for com_num in range(393000, 394000, 1):with open(os.path.join(lc_path, f"{com_num}.cis"), "wb") as cisf:
我以bk为变量,遍历10次,怎样修改好,请大佬帮忙 看下 不懂啊,,希望有人能帮助你 for i in range(bk) python我也是刚学 也一直在等这个答案呢 球大佬 是要嵌套循环10次吗?
bk=10
for i in range(bk-1):
for com_num in range(393000, 394000, 1):
with open(os.path.join(lc_path, f"{com_num}.cis"), "wb") as cisf:
for i in range(bk)或者
for i in range(1,bk+1) bk=10
for com_num in range(393000, 394000, 1):
bk-=1
if bk<0:
break
with open(os.path.join(lc_path, f"{com_num}.cis"), "wb") as cisf: 遍历就用for循环就行了呀。if else 也行 我叫小月亮 发表于 2021-11-17 22:12
bk=10
for com_num in range(393000, 394000, 1):
bk-=1
谢谢,大佬,但com_num这个后面还有用到这个变量,break后就无法 了
页:
[1]
2