The python coding problem is really a headache, Python features nothing to say, very powerful, but once you encounter coding problems OH
One, do not read from the file, if I want to create a Chinese folder
eg
#coding =utf-8
Import OS
str= "Thinkgamer Blog"
Os.mkdir (str)
Print str
Then the Chinese part of the created folder is garbled, print out the normal
Workaround: Remove Coding=utf-8 or change utf-8 to GBK encoding
Second, read from the file, create a folder
eg
File format is Utf-8
#coding =utf-8
Import OS
fp = open (' Thinkgamer.txt ', ' R ')
Str=fp.readline ()
Print str
Os.mkdir (str)
Can print the results correctly, but creating a folder name is really garbled
However, this is not what we want, but how to solve it?
As follows: simply save the file as an ANSI format
The follow up will also be updated ....
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Python Coding issues