python路径中有中文_python中的中文路径解决

时间:2025-02-18 08:04:03

python中的中文路径解决:

注:

1、('utf-8')将python默认encode改为utf-8

2、(('utf-8')+"\n")写入时再encode('utf-8')

vi

#!/usr/bin/python

#coding=utf-8

import os

import shutil

import sys

reload(sys)

('utf-8')

dir="/root/python"

for root,dirs,files in (dir):

for f in files:

if f == "":

s = ((root,f))

p = open('/root/python/logs/','a')

(('utf-8')+"\n")

()

c = open('/root/python/logs/','r')

for i in ():

(())

:wq

python