Create folders and resolve issues with Unicode and ASCII conversion

Source: Internet
Author: User
Tags date1

#-*-Coding:utf-8-*-
Import Sys
Import time
Import OS #解决unicode和ASCII码转换的问题
Reload (SYS) #解决unicode和ASCII码转换的问题
Sys.setdefaultencoding (' UTF8 ') #解决unicode和ASCII码转换的问题


context = ' Hello World '
f = open ("Hello.txt", ' A + ')
F.write (context)
F.close ()
Date1 = Time.strftime ("%y%m%d", Time.localtime ())
Date2 = "+time.strftime" ("%u", Time.localtime ()) + "Week"
Date3 = "Week" + time.strftime ("%w", Time.localtime ())

Print Date1
Print Date2
Print Date3
Date1 = str (date1) +str (date2) +str (date3)
# date1 = Date1.encode (Unicode)

Path = u "d:\ working directory \ \"
# Print Date1
# path = path + path1 + date1
Path = str (path) + str (date1)
# Print Path
Os.mkdir (Path.encode (' GBK '))
#os. mkdir (Path.encode (' GBK '))
# Print Path.decode (' gb2312 ')
#path. Decode (' gb2312 ')
# path = path + date1
# Print Path
# Os.mkdir (R ' d:\ working directory \temp ')
# lll = R ' D:\Hello\Time ' +date1
# print LLL
# Os.mkdir (LLL)
# Print Path
# Os.mkdir (PATH)

Create folders and resolve issues with Unicode and ASCII conversion

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.