Zipping together unicode strings in Python

后端 未结 4 1755
感动是毒
感动是毒 2021-01-24 18:18

I have the string:

a = \"ÀÁÂÃÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜ\" b = \"àáâãäèéçêëìíîïòóôõöùúûüÿ\"

and I want to create the string

\"ÀàÁáÂâ...\"         


        
4条回答
  •  攒了一身酷
    2021-01-24 18:47

    This is working on my side (Python 2.x):

    >>> a = unicode('ÀÁÂÃÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜ', 'utf-8')
    >>> b = unicode('àáâãäèéçêëìíîïòóôõöùúûüÿ', 'utf-8')
    >>> print ''.join([ ''.join(c) for c in zip(a, b)])
    ÀàÁáÂâÃãÈäÉèÊéËçÌêÍëÎìÏíÒîÓïÔòÕóÖôÙõÚöÛùÜú
    

    What error do you have?

提交回复
热议问题