0
Class
class a: def __init__(self): pass def c(self,d): d = print a = a() a.c(('Hello!')) why it prints nothing?
2 ответов
+ 5
You should replace:
d = print
with:
print(d)
It will work then.
+ 2
class a:
def __init__(self):
pass
def c(self,d):
print(d)
x = a()
x.c('Hello!')
Also you should create an object with a different name of "a" because "a" is already the name of the class and so there might be conflicts between a the class and a the object.