1. Byte Order, Size, and Alignment

 

Character

Byte order

Size

Alignment

@

native

native

native

=

native

standard

none

<

little-endian

standard

none

>

big-endian

standard

none

!

network(=big-endian)

standard

none

 

 

2. Format Characters

 

Format

C type

Python type

Standard size

x

pad type

no value

 

c

char

bytes of length 1

1

b

signed char

integer

1

B

unsigned char

integer

1

?

_Bool

bool

1

h

short

integer

2

H

unsigned short

integer

2

i

int

integer

4

I

unsigned unt

integer

4

l

long

integer

4

L

unsigned long

integer

4

q

long long

integer

8

Q

unsigned long long

integer

8

n

ssize_t

integer

 

N

size_t

integer

 

e

 

float

2

f

float

float

4

d

double

float

8

s

char[]

bytes

 

p

char[]

bytes

 

P

void*

integer

 

 

Reference

https://docs.python.org/3.7/library/struct.html

'Python' 카테고리의 다른 글

( ) = ( ) if ( ) else ( ) 구문  (0) 2019.12.27
변수명  (0) 2019.12.27
python statements  (0) 2019.12.27
binary data pack unpack examples  (0) 2019.12.27
list comprehension과 for loop 벤치  (0) 2019.12.27

+ Recent posts