python2與python3的區別

在Windows系統中搭建Python編程環境python

#!/usr/bin/env python編程

此code表達在windows系統中pycharm使用條件!windows

ACISS碼在不一樣工具中使用的條件
手機,MP3支持各類版本GB2312,
可收錄不一樣文字用做編寫程序
而電腦可支持GB18030
unicode表示爲統一萬國碼,及各個國家的編碼均可使用
它爲每一個語言中的每一個字符設定了統一而且惟一的二進制編碼,規定雖有的字符和符號最少由16位來表示(2個字節),即:2**16=65536
utf-8表示可變長的
app

utf-8用於Python2.0中將字符代碼轉換成中文,而在Python3.0不存在此狀況,創做者已經將code進行了系統升級!工具

ACISS碼轉換的歷史
 ASCII 255 1bytes
--> 1980 gb2312 7000多漢字
--> 1995 GBK.0 2w+
--> GB18030 27xxx
--> unicode 2bytes
--> utf-8  e:1byte, zh:3bytes
-->raw_input 2.x  = input 3.x
this


用戶交互程序:
------info of %s ----
------info of ''' + character + ''' ----
------info of
{_name}----編碼

 

# Author Eric fengspa

name = input("name:")code

#raw_input 2.x input  3.xorm

#input 2.x =

age = int(intput("age:"))#integer

print(type(age), type( str(age)))

job = input("job:")

salary = input("Salary:")

info = ""

-------info of %s -----

Name:%s

Age:%d

job:%s

Salary:%s

"%(name,name,age,job,salary)

info2 = ""

------info of {_name} -----

Name:{_name}

Age:{_age}

Job:{_salary}

'''.format(_name=name,

              _age=age,

              _job=job,

             _salary=salary)

 

info3 = ""

-------info of  {0}-----

Name:{0}

Age:{1}

Job:{2}

Salary:{3}

'''.format(name,age,job,salary)

print(info3)

這是三種不一樣用戶交互模式

區別:info of 後綴格式不一樣,Y just use different code named "%s"But "%s"can not use into integer string,Y need change the %d to explore the number function,Sometimes plus "int" forhead of the age ,That will can be apply the program,

Second two:

Y just plus the {} this one to recongise different code.For instance {_name} and {int},So What is defferent ,You see. different line just like instead of the code,give the new meaning

相關文章
相關標籤/搜索