Unsupported characters in input
I want to assign a string of characters to a variable but it says
: there isn't a "code to show.
I have a string that i wan开发者_运维知识库t to assign to a variable
d="stunning:/ËstÊnɪÅ/"
Unsupported characters in input
or
word="stuning:/ˈstraɪkɪŋ/"
Unsupported characters in input
so basically the interpreter doesn't allow me to assign it to a variable, so I can't code on it.
How can I extract, delete those characters from the text, or is there anything to do , so python will support this kind of input.
I've tried to converted it into others format like ansi, utf, etc. but without success.
P.S.: I'm using python 2.7
Set the source file encoding accordingly to the actual encoding of the file, so that the interpreter knows how to parse it.
For instance, if you use UTF-8, just add this string to the header of the file:
# -*- coding: utf8 -*-
It must be the first or the second line of the file. See PEP 0263: Defining Python Source Code Encodings.
Just a hint (waiting for the actual code): prepend u
to the string to mark it as unicode.
u"/ËstraɪkɪÅ/"
精彩评论