Python中列表数据结构的比较操作

huangapple go评论56阅读模式
英文:

Comparison Operation of List Data Structure on Python

问题

假设我有一个列表数据结构:list。
我看到了一段代码:list[:,0]>5
我不知道它的意思是什么?但我知道list[:,0]是什么意思。

我在Google上搜索了很多关于这个问题的内容,查阅了很多Python官方文档,但是没有找到合适的答案。

英文:

Assuming that I have a List data strecture: list.
And I see one code: list[:,0]>5
I don't know what it means? But I know what list[:,0] means.

I google it and read many in python.org but I can't acquire appropriate answer.

答案1

得分: -1

list > 5 比较列表中的每个元素与 5,如果大于 5,则结果为 True,否则为 False。
所以如果:

list=[1,2,6]
list > 5
# -> [False, False, True]。
英文:

I realized it's a very simple thing:

list > 5 compares every elements of list with 5, if it is larger than 5 the result is True, else False.
So if

list=[1,2,6]
list > 5
# -> [False, False, True].

huangapple
  • 本文由 发表于 2023年2月6日 16:25:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/75358884.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定