Python 判断一个字节数组是否 beginsWith 另外一个字节数组,pythonbeginswith,python代码impo
Python 判断一个字节数组是否 beginsWith 另外一个字节数组,pythonbeginswith,python代码impo
python代码
import chilkatzipData = chilkat.CkByteData()gifData = chilkat.CkByteData()# Zip files begin with these 4 bytes:zipBegin = chilkat.CkByteData()zipBegin.append('\x50\x4B\x03\x04',4)# GIF files begin with "GIF89", which is this byte sequence:gifBegin = chilkat.CkByteData()gifBegin.append('\x47\x49\x46\x38\x39',5)success = zipData.loadFile("dude.zip")if (success == True): if (zipData.beginsWith(zipBegin)): print "Yes, this is a .zip archive!" else: print "No, this is not a .zip archive."else: print "Failed to load dude.zip"success = gifData.loadFile("dude.gif")if (success == True): if (gifData.beginsWith(gifBegin)): print "Yes, this is a GIF image!" else: print "No, this is not a GIF image."else: print "Failed to load dude.gif"
相关内容
- Python 将 Byte Array 保存到文件,pythonarray,python代码impo
- Py4J 示例代码 (Python 调用 Java API),py4jpython,python代码
- python Huffman树,pythonhuffman树,[Python]代码#!
- python 3.3下结合tkinter做的比大小程序,pythontkinter,step1
- Householder similarity transformation of matrix in Python,,''' d,c
- 实现追磨铁上小说功能,追磨铁小说,最近一直在磨铁上
- Python的map、reduce和filter以及list comprehension(列表推导)
- 生成随机密码python 窗口程序,python窗口,随机码主窗口
- 计算阶乘,,[Python]代码pr
- 通过动态代理生成基于gfwlist的动态代理脚本,,[Python
评论关闭