1 # !/usr/bin/env python 2 # -*- coding:utf-8 -*- 3 """ 4 Assign the variable x to a string 'Please enter the user name:' The assignment of the variable x_unicode is equal to the value of the x variable Decode, specify that the x variable is originally UTF-8 5. The assignment of the variable x_gbk is equal to the encoding of x_unicode, and it is specified to be compiled into gbk. The assignment of the variable user is equal to the content input by the user x_gbk, and the assignment of the variable y 6 is the string 'Please enter the password:' The assignment of the variable y_unicode is equal to the decoding of the y variable. The specified y variable is originally UTF-8 . The assignment of the y_gbk variable is equal to the encoding of the y_unicode . The assignment is equal to the string 'your username is:' The assignment of the variable u_unicode is equal to the decoding of the variable u, the specified u variable is originally utf-8, the assignment of the variable 9 u_gbk is equal to the encoding, the assignment of the specified code is gbk, the assignment of the variable p is equal to The string 'your password is:' The assignment of the variable p_unicode to 10 is equal to the decoding of the variable p, specifying that the original encoding of p is utf8 The assignment of the variable p_gbk is equal to the encoding of the variable p_unicode, specifying that it is encoded into gbk 11 Input print variable u_gbk Connector variable user connector newline connector variable p_gbk connector variable pwd 12 """ 13 #This is used in python 2.X 14 x = ' Please enter a user name: ' 15 x_unicode = x.decode( ' utf-8 ' ) 16 x_gbk = x_unicode.encode( ' gbk ' ) 17 user = raw_input(x_gbk) 18 y = ' Please enter the password: ' 19 y_unicode = y.decode( ' utf-8 ' ) 20 y_gbk = y_unicode.encode( ' gbk ' ) 21 pwd = raw_input(y_gbk) 22 u =" Your username is: " 23 u_unicode = u.decode( ' utf-8 ' ) 24 u_gbk = u_unicode.encode( ' gbk ' ) 25 p = " Your password is: " 26 p_unicode = p.decode( ' utf-8 ' ) 27 p_gbk = p_unicode.encode( ' gbk ' ) 28 print (u_gbk + user + ' \n ' + p_gbk + pwd)