开发者

Encoding Japanese characters

开发者 https://www.devze.com 2023-04-09 03:07 出处:网络
How would I encode the following: chapter_mapping = {\'chapter\': \' チャプター\'} so I can call chapter_mapping[\'chap开发者_开发知识库ter\']. Thank you.You\'ll also need to add a header to your f

How would I encode the following:

chapter_mapping = {'chapter': ' チャプター'}

so I can call chapter_mapping['chap开发者_开发知识库ter']. Thank you.


You'll also need to add a header to your file in python 2:

# -*- coding: utf-8 -*-
chapter_mapping = {'chapter': u'チャプター'}


Always use unicode literals.

chapter_mapping = {'chapter': u' チャプター'}
0

精彩评论

暂无评论...
验证码 换一张
取 消