pythonで #UnicodeEncodeError: 'cp932' codec can't encode character ~: illegal multibyte sequence に対処した Python

ファイル開く時にutf8指定しなかったばっかりに出たエラー
#UnicodeEncodeError: cp932 codec can t encode character ¥u200c in position 274: illegal multibyte sequence

解決策
with open(path mode= w encoding= UTF-8 ) as f:

修正前
with open(path mode= w ) as f: