Skip to content

probloem solving

jaeseok.an edited this page Mar 18, 2020 · 2 revisions

Endian

  • multibyte 숫자를 상위 BYTE 부터 저장할지 하위 Byte부터 저장할지에 따라 결정
  • big endian
    • 0x12 34 56 78 을 순서대로 0x12, 0x34 0x56, 0x78 로 메모리에 순서대로 저장
    • 역사적으로 ip 주소는 big endian으로 저장됨
  • littel endian
    • 0x78, 0x56, 0x34, 0x12 순서로 메모리에 저장
    • intel format

python

  • array 생성
    charr = [0] * 100
    charr = array('i', (0 for i in range(0, 100))) # 여기서 'i'가 type
    
  • string iteration
    for ch in sampleStr:
        print(ch)
    for i in range( len(sampleStr) ):
        print(sampleStr[i])
    
  • type 변환
    • char to int
      • ord(ch)
    • int to char
      • chr(int)
    • str(obj), obj(str)

test

Clone this wiki locally