Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.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:error';列表';对象没有属性';已排序';_Python - Fatal编程技术网

Python:error';列表';对象没有属性';已排序';

Python:error';列表';对象没有属性';已排序';,python,Python,这是我的代码: #这是一个有关旅行的程序 place=['北京天安门','西安兵马俑','香港游乐园','日本秋叶原'] print(place) print(sorted(place)) print(place) place.sorted(reverse=true) print(place) 当我运行代码时,发生了一些错误 place.sorted(reverse=true) 或 使用第二种方法,我如何给出(reverse=true)?只需使用排序(place,reverse=true

这是我的代码:

#这是一个有关旅行的程序
place=['北京天安门','西安兵马俑','香港游乐园','日本秋叶原']
print(place)
print(sorted(place))
print(place)

place.sorted(reverse=true)
print(place)
当我运行代码时,发生了一些错误

place.sorted(reverse=true)



使用第二种方法,我如何给出
(reverse=true)

只需使用
排序(place,reverse=true)

它要么是
排序的
(不在原地)要么是
列表。排序
(在原地)
。在这两种情况下,它们都接受一个
reverse`关键字参数您可以通过阅读错误消息和文档,甚至只是在python中搜索“python list sort reverse”,轻松解决这个问题,True和True没有什么不同??我认为这是正确的。非常感谢。非常感谢!这是我的错误,我的真实是真实的。现在我知道真实是真实的。
sorted(place)