Python Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

Python Examples

Quick Start
Unicode
Byte Array
Bz2
Certificates
CSV
Email
Encryption
FTP
HTML Conversion
HTTP
IMAP
MHT
MIME
POP3
RSA
S/MIME
Signatures
Socket / SSL
SFTP
SMTP
Spider
SSH Key
SSH
SSH Tunnel
Tar
HTTP Upload
XML
XMP
Zip

More Examples...
String
Amazon S3
Email Object
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

 

beginsWith -- Check if Byte Array Begins with Byte Sequence

Determine if a byte array begins with a specific byte sequence.

 Chilkat Python Module Downloads for Windows, Linux, and MAC OS X

import chilkat

zipData = 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"

 

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.