类中声明一个__str__函数,用来返回类的字符串输出格式
class Face():featureName = None
index = 1
instanceName ='A-Bushing_s-20151111-1'
isReferenceRep = False
pointOn = ((-1.268087, -19.208438, -16.0),)
def __str__(self):
#这里你可以根据需要拼装s变量
s = "({'featureName': None, 'index': 1, 'instanceName': 'A-Bushing_s-20151111-1', 'isReferenceRep': False, 'pointOn': ((-1.268087, -19.208438, -16.0),)})"
return s
a = [Face(),Face()]
print(a[1])
可以使用 Python Image Library 做,load() 函数会返回一个对象,这个对象我们可以把它当作一个二维数组对待,而数组中存放的就是点的 RGB 值,可以很容易地访问到任何像素点的 RGB 值:from PIL import Image
# 可以支持很多种图片格式.
im = Image.open("your_picture.jpg")
pix = im.load()
# 获得图片的尺度,可以用于迭代
print im.size
# 获得某个像素点的 RGB 值,像素点坐标由 [x, y] 指定
print pix[x,y]
# 设置 [x, y] 点的 RGB 的值为 value
pix[x,y] = value