Pythonでバイト型を文字列型へ変更する

概要

下記のようなエラーが出た場合は、オブジェクトがバイト型になっている。

AttributeError: 'bytes' object has no attribute XXX

対策

decode()を使うとstring型になる。

myip = myipdata.read().decode()