How to solve the problem of Python unicode ascii encoding on windows

Source: Internet
Author: User

Unicode ascii encoding is a commonly used computer application step in computer-related practical applications. If you install unicode ascii encoding in Python, you will experience the powerful functions of the powerful combination, the following is an introduction to the relevant content of the article. I hope you will have some gains.

Python unicode ascii encoding in windows, * nix issues unless your English is good enough or is it related to Chinese, I will definitely use Chinese in python code anyway, code that can run well in windows should not run well in * nix,

The following code

 
 
  1. #! /Usr/bin/env python
  2. # Coding = UTF-8
  3. Print u "Beijing". encode ("gbk", 'ignore ')

It works well in windows, but not in * nix, because by default, windows programs run the ascii mechanism, and in * nix, for example, I use unicode in ubuntu, therefore, print "Beijing" In ubuntu,

Note that the encoding of your python script file is UTF-8.

Later, I found some related article links, which are listed only in the python unicode ascii code on windows and * nix. They are not verified.

Python Chinese encoding in Linux. _ Tianya blog _ all knowledgeable people are here _ Tianya community

  • How to embed Python into C ++
  • Application of Three simple functions in multiple threads in Python
  • Introduction to the powerful functions of the three functions in Python Multithreading
  • Python Thread Programming solves the problem of different speeds in asynchronous threads
  • Python embedded in C/C + has very powerful application functions

I want to use UTF8 encoding in the source code when writing Python programs in Windows. How can this problem be solved?

String and unicode (1)-java_jing logs in Python

Python character encoding conversion _ Grand Theft/Paulau python encoding conversion-this Blog is very powerful

Tips for conversion of Python character encoding-hand Chen introduction-BlogJava

[Python learning] Unicode and encoding processing experience-limodou learning history-DonewsBlog

UTF-8 and Unicode FAQ about the conversion of Chinese encoding-PYTHON miscellaneous-away from the rest of the world ......

In Python, convert any encoded string to Unicode encoding. at Python + C = Nuclear

The above content is for the python unicode ascii code in windows. * answers to the nix problems may be appreciated.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.