Python:错误' list'对象没有属性'排序'

时间:2017-12-11 12:01:43

标签: python

这是我的代码:

var $ = require('jquery').
browser.perform(function(dir)){
var flag = `$`('span').hasClass('red'); //throws error 
}

当我运行我的代码时,发生了错误的事情。

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

place.sorted(reverse=true)
print(place)

place.sorted(reverse=true)

使用第二种方式,我如何提供sorted(place)

1 个答案:

答案 0 :(得分:2)

只需使用sorted(place, reverse=True)