跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • 问下如下代码 Python 类为啥有不同的结果?
未分類
11 3 月 2021

问下如下代码 Python 类为啥有不同的结果?

问下如下代码 Python 类为啥有不同的结果?

資深大佬 : coolair 1

class Test(models.Model):     name = models.CharField('名称', max_length=64, unique=True)      def __init__(self, *args, **kwargs):         super(Test, self).__init__(*args, **kwargs)         print(self, type(self))    # 为啥这里 self 是空白?   class Test(object):     def __init__(self, name):         print(self)  # 为啥这里 self 有东西?         self.name= name  test = Test(name='aaa')    # 输出<Test object at 0x000002A3E4016F70> 

大佬有話說 (1)

  • 主 資深大佬 : coolair

    我的锅,哈哈。

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具