Python if语句检查字符串中的英镑符号?

Ryf*_*lex 3 python unicode if-statement python-2.7

我有以下行导致我的问题:

if "Total £" in studentfees:

收益:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xa3 in position 4: ordinal not in range(128)

我怎么能绕过这个?

提前谢谢 - Hyflex

Sim*_*ser 7

您可以将以下内容添加到文件中:

# -*- coding: utf-8 -*-
Run Code Online (Sandbox Code Playgroud)

也:

if u"Total £" in studentfees:
Run Code Online (Sandbox Code Playgroud)