Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(0)  |  Derive(0)  |  Import(1)
Write int as big endian formatted string, (asserts length in [1,2,4])
Difficult to print the result in doctest, so I do a simple roundabout test.
>>> readBew(writeBew(25057, 2))
25057
>>> readBew(writeBew(1642193635L, 4))
1642193635L

        def writeBew(value, length):
    """
    Write int as big endian formatted string, (asserts length in [1,2,4])
    Difficult to print the result in doctest, so I do a simple roundabout test.
    >>> readBew(writeBew(25057, 2))
    25057
    >>> readBew(writeBew(1642193635L, 4))
    1642193635L
    """
    return pack('>%s' % {1:'B', 2:'H', 4:'L'}[length], value)
        


src/c/a/canta-HEAD/canta/midi/RawOutstreamFile.py   canta(Download)
 
# custom import
from DataTypeConverters import writeBew, writeVar, fromBytes
 
class RawOutstreamFile: