随笔分类 - Python
摘要:1、python中的小括号( ):代表tuple元组数据类型,元组是一种不可变序列。>>> tup = (1,2,3) >>> tup (1, 2, 3) 2、python中的中括号[ ],代表list列表数据类型:>>> list('python') ['p', 'y', 't', 'h', 'o
阅读全文
摘要:python解析XML常见的有三种方法:一是xml.dom.*模块,它是W3C DOM API的实现,若需要处理DOM API则该模块很适合,注意xml.dom包里面有许多模块,须区分它们间的不同;二是xml.sax.*模块,它是SAX API的实现,这个模块牺牲了便捷性来换取速度和内存占用,SAX
阅读全文
摘要:图片处理pip install pillow from PIL import Image import numpy as np a = np.array(Image.open('test.jpg')) b = [255,255,255] - a im = Image.fromarray(b.asty
阅读全文