这是某种数组(Python)吗?
我正在学习Python和RPI,Sense HAT emulator的示例中有一个脚本,我不知道一对代码对我来说是什么,它们看起来像一个数组,但我认为它们可能是其他类型的数据,因此代码如下:这是某种数组(Python)吗?,python,python-3.x,raspberry-pi,Python,Python 3.x,Raspberry Pi,我正在学习Python和RPI,Sense HAT emulator的示例中有一个脚本,我不知道一对代码对我来说是什么,它们看起来像一个数组,但我认为它们可能是其他类型的数据,因此代码如下: from sense_emu import SenseHat sense = SenseHat() green = (0, 255, 0) white = (255, 255, 255) while True: humidity = sense.humidity humidity_va
from sense_emu import SenseHat
sense = SenseHat()
green = (0, 255, 0)
white = (255, 255, 255)
while True:
humidity = sense.humidity
humidity_value = 64 * humidity / 100
pixels = [green if i < humidity_value else white for i in range(64)]
sense.set_pixels(pixels)
它们用于存储RGB颜色三元组。
您可以通过调用type(obj)
获取它们用于存储RGB颜色三元组。
您可以通过调用type(obj)
获取
green = (0, 255, 0)
white = (255, 255, 255)