小编Fel*_*hia的帖子

Python代码,自定义未定义

class makeCode:
    def __init__(self,code):
            self.codeSegment = code.upper()
            if checkSegment(self.codeSegment):
                    quit()
            self.info=checkXNA(self.codeSegment)
    def echo(self,start=0,stop=len(self.codeSegment),search=None): #--> self not defined
            pass
Run Code Online (Sandbox Code Playgroud)

不工作......

  • 它说变量self实际上并没有被定义;
  • checkSegment如果输入不是由nucleotids字母组成的字符串,或者如果包含不能在一起的nucleotids,则函数返回1;
  • 它会退出,如果发生这种情况,那就可以了.
  • 然后它分配信息(如果它是RNA或DNA)检查函数checkXNA返回带有信息"dnaSegment"或"rnaSegment"的字符串; 工作得很好.

但是echo,为打印更具体的信息而设计的功能告诉我,自我没有定义,但为什么呢?

python

3
推荐指数
2
解决办法
171
查看次数

标签 统计

python ×1