【发布时间】:2018-03-15 10:51:12
【问题描述】:
class y():
def __init__(self,favourite_channels = [""]):
self.favourite_channels= favourite_channels
def favourite_channels(self,i):
print("Ur Favourite Channel=",i)
self.favourite_channels.append(i)
x = y()
print("""*******************
1. Favourite Channel
press q to the exit
*******************""")
while True:
a = input("Select : ")
if a=="1":
channels=input("Your fav channels use , to the split")
addable_channels =channels.split(",")
for i in addable_channels:
x.favourite_channels(i)
elif a=="q":
break
else:
print("İnvalid Number")
【问题讨论】:
-
请确保您的代码格式正确并提供 minimal reproducible example。此外,纯代码问题也无济于事。
-
是的,
list object is not callable正是我期望从这段代码中得到的输出。你想发生什么? -
想将此 i 发送给我的 functian,然后将其添加为最喜欢的频道。它只是我代码的一部分,所以想将它添加为最喜欢的频道,我将编写 str 函数将输出我最喜欢的频道
-
我的英语不太好 :P 对不起,顺便说一句
标签: python python-3.x function