-1
def create_msg(content: bytes) -> bytes:
size = len(content)
return encode_msg_size(size) + content


def encode_msg_size(size: int) -> bytes:
return struct.pack("<I", size)

この 2 つの関数を python3 から python2.7 に移行したいのですが、毎回構文エラーが発生します。誰かが何か考えがありますか?

エラー: File "__init__.py", line 4 def create_msg(content: bytes) -> bytes: SyntaxError: invalid syntax

4

2 に答える 2