我想知道,有没有一种方法可以在我的主要方法上存储开始值和结束值。我尝试这样做,但它给了我错误:
def searchM():
fileAddress = '/database/pro/data/'+ID+'.txt'
with open(fileAddress,'rb') as f:
root = etree.parse(f)
for lcn in root.xpath("/protein/match[@dbname='M']/lcn")
start = int(lcn.get("start"))#if it is PFAM then look for start value
end = int(lcn.get("end"))#if it is PFAM then also look for end value
return "%s, %s" % (start, end,)
values = searchM()
(start, end,) = values
错误消息是 UnboundLocalError: local variable 'start' referenced before assignment