码:
class MyClass:
def __init__(self, aa ):
print('aa='+str(aa)+' of type '+str(type(aa)))
self.aa = aa,
print('self.aa='+str(self.aa)+' of type '+str(type(self.aa)))
DEBUG = MyClass(aa = 'DEBUG')
Run Code Online (Sandbox Code Playgroud)
输出:
aa=DEBUG of type <type 'str'>
self.aa=('DEBUG',) of type <type 'tuple'>
Run Code Online (Sandbox Code Playgroud)
为什么会self.aa成为元组而不是字符串?
| 归档时间: |
|
| 查看次数: |
618 次 |
| 最近记录: |