下面是我用PyCharm编写的代码。我不明白为什么它不能正常运行并打印出“Chuck”。当我在PyCharm中运行代码时,我得到以下消息“processfinishwithexitcode0”。我正在努力学习Python并跟随YouTube播放列表,但我一直被困在这里。提前谢谢你!在
class class_name:
def createName(self, name):
self.name=name
def display_name(self):
return self.name
def saying(self):
print("hello %s" % self.name)
first=class_name()
second=class_name()
first.createName('Chuck')
second.createName('tony')
first.display_name()
你好Chuck0185
在启动Python3之前,请先阅读此最佳网站,
1https://www.tutorialspoint.com/python3/
2https://docs.python.org/3/tutorial/
三。https://learnpythonthehardway.org/python3/
python 2和python 3的区别,
1http://sebastianraschka.com/Articles/2014_python_2_3_key_diff.html
2https://www.quora.com/What-are-the-major-differences-between-Python-2-and-Python-3
Pycharm工具知识,用于最佳网站,
1https://www.jetbrains.com/help/pycharm/2017.1/creating-and-running-your-first-python-project.html
尝试此代码, 使用Python2:
使用Python3:
^{pr2}$我希望我的回答对你有用。在
试试这个:
作为first.display_名称()返回一个字符串,您需要使用print在终端中显示值。在
相关问题 更多 >
编程相关推荐