Multiplying a tuple by a scalar

后端 未结 12 888
忘了有多久
忘了有多久 2020-12-14 14:48

I have the following code:

print(img.size)
print(10 * img.size)

This will print:

(70, 70)
(70, 70, 70, 70, 70, 70, 70, 70,          


        
12条回答
  •  隐瞒了意图╮
    2020-12-14 15:00

    In line with the previous answers but using numpy:

    import numpy as np
    result = tuple(10*np.array(img.size))
    

提交回复
热议问题