guanpengchn / guanpengchn/guanpengchn.github.io
python将unicode和str互相转化
Open
Nobody has claimed this yet.
study
- Dominant language
- HTML
- Stars
- 18
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
问题一:
将u'\u810f\u4e71'转换为'\u810f\u4e71'
方法:
s_unicode = u'\u810f\u4e71'
s_str = s_unicode.encode('unicode-escape').decode('string_escape')
问题二:
将'\u810f\u4e71'转换为u'\u810f\u4e71'
方法:s_str = '\u810f\u4e71's_unicode = s_str.decode('unicode-escape')
问题三:
将'\xe5\x8c\x97'转换为'\\u5317'
方法:s_x = '\xe5\x8c\x97' s_uescape = s_x.decode('utf-8').encode('unicode-escape')
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The payload names no repository file, test, or entry point. First determine whether issue #4 is intended as a documentation or content change about Python Unicode conversions, then define the desired examples and acceptance criteria before locating the relevant blog source.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- content, documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100