Special characters problems using Python unicode

前端 未结 4 1223
生来不讨喜
生来不讨喜 2021-01-15 19:54
#!/usr/bin/env python
# -*- coding: utf_8 -*-

def splitParagraphIntoSentences(paragraph):

\'\'\' break a paragraph into sentences
    and return a list \'\'\'
             


        
4条回答
  •  抹茶落季
    2021-01-15 20:10

    p = "While other species..."
    

    should be changed to

    p = u"While other species..."
    

    Notice the u in front of the quote.

    What you need is a so-called Unicode literals. In Python 2, string literals is not Unicode by default.

提交回复
热议问题