一条胖咸鱼鸭 发表于 2021-2-1 14:29:05

python39讲,类和对象,拾遗

按照小甲鱼的步骤运行pool = Pool (1,10),再运行pool.Print_num(),到了pool.Print_num()这里
运行报错是:
ValueError: unsupported format character '?' (0x6761) at index 15
小白,不理解,求助


class Turtle:
    def __init__(self,x):
      self.num = x


class Fish:
    def __init__(self,x):
      self.num = x


class Pool:
    def __init__(self,x,y):
      self.turtle = Turtle(x)
      self.fish = Fish(y)


    def Print_num(self):
      print('水池里总共有乌龟%d只,小鱼%条'% (self.turtle.num,self.fish.num))
页: [1]
查看完整版本: python39讲,类和对象,拾遗