이항 연산자를 사용하면 bytesbytes와 비교하거나 strstr과 비교할 수 있다.

    assert b'red' > b'blue'
    assert 'red' > 'blue'

    하지만 str 인스턴스와 bytes 인스턴스를 비교할 수는 없다.

    assert 'red' > b'blue'
    
    >>>
    Traceback ...
    TypeError: '>' not supported between instances of 'str' and 'bytes'

    bytes 인스턴스와 str 인스턴스를 비교할 수도 없다.

    assert b'blue' < 'red'
    
    >>>
    Traceback ...
    TypeError: '<' not supported between instances of 'bytes' and 'str'
    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.