Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/351.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 为什么会有不同的结果?_Python_Django_Pycharm - Fatal编程技术网

Python 为什么会有不同的结果?

Python 为什么会有不同的结果?,python,django,pycharm,Python,Django,Pycharm,这里有一个类似的问题,您可能会看到Python版本存在问题。 这里是我所拥有的:(最后一行输出中的差异) Ubuntu终端: ***@***:~/Documents/Coding/Django/myfirst$ python3 manage.py shell Python 3.6.9 (default, Nov 7 2019, 10:44:02) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for

这里有一个类似的问题,您可能会看到Python版本存在问题。 这里是我所拥有的:(最后一行输出中的差异)

Ubuntu终端:

***@***:~/Documents/Coding/Django/myfirst$ python3 manage.py shell
Python 3.6.9 (default, Nov  7 2019, 10:44:02) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from articles.models import Article, Comment
>>> a = Article.objects.get(id = 1)
>>> a
<Article: How to...?>
>>> a.comment_set.all()
<QuerySet [<Comment: John>, <Comment: Jack>, <Comment: Nelson>, <Comment: Bill>]>
***@***:~/Documents/Coding/Django/myfirst$ python3 manage.py shell
Python 3.6.9 (default, Nov  7 2019, 10:44:02) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from articles.models import Article, Comment
>>> a = Article.objects.get(id = 1)
>>> a.id
1
>>> a.article_Title
'How to...?'
>>> a.comment_set.all()
<QuerySet [<Comment: Comment object (1)>, <Comment: Comment object (2)>, <Comment: Comment object (3)>]>

这很有趣,但我想,唯一的区别是交互控制台打印对象的方式。它就像python shell:

<__main__.A object at 0x7f1466211630>

对伊皮顿

<__main__.A at 0x7f5a270fb4e0>


我将尝试找出它发生的原因。

这很有趣,但我想,唯一的区别是交互控制台打印对象的方式。它就像python shell:

<__main__.A object at 0x7f1466211630>

对伊皮顿

<__main__.A at 0x7f5a270fb4e0>


我将尝试找出发生这种情况的原因。

您能显示manage.py文件吗?添加了manage.py中的代码。谢谢大家的关注!能否显示manage.py文件?添加了manage.py中的代码。谢谢大家的关注!谢谢你的关注,伙计!谢谢你的关注,伙计!