Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

After some testing, I'm more confident about this answer
Source Link
Patrick McElhaney
  • 59.6k
  • 41
  • 138
  • 170

Are you puttingYou have to escape the character in question (–) and put a u in front of the string literal?

re to make it a unicode string.compile("–")

vs.So, for example, this:

re.compile("–") 

re.compile(u"–")becomes this:

re.compile(u"\u2013")

Are you putting a u in front of the string literal?

re.compile("–")

vs.

re.compile(u"–")

You have to escape the character in question (–) and put a u in front of the string literal to make it a unicode string.

So, for example, this:

re.compile("–") 

becomes this:

re.compile(u"\u2013")
Source Link
Patrick McElhaney
  • 59.6k
  • 41
  • 138
  • 170

Are you putting a u in front of the string literal?

re.compile("–")

vs.

re.compile(u"–")

lang-py

AltStyle によって変換されたページ (->オリジナル) /