【发布时间】:2021-02-20 02:34:44
【问题描述】:
import os; import time;
not_command_error = "error: not an command"
empty_error = "error: file empty"
def read(file):
e = open(file, "r")
b = e.readlines()
e.close()
return b
code_file = "put your code here"
e = read(code_file)
if e == []:
print("\033[0;37;41m",empty_error)
time.sleep(90000)
count = len(e)
print(count)
g = 0
l = 0
while True:
l+= 1
t = open(code_file, "r")
y = t.readlines(l)
t.close()
k = len(y)
print(y[k])
u = y[k]
g+= 1
if count == g:
break
这是我的代码,我得到并索引超出范围错误,有什么帮助吗? 我尝试更改格式,但仍然无法正常工作。 我得到索引超出范围错误,我不使用变量吗?
【问题讨论】: