版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
Approach走近DepartmentofComputerScienceandDepartmentofUniversityBasicComputer22用用PythonPYTHON33擁有簡(jiǎn) 語(yǔ)言和解 型程序語(yǔ)言的易用擁有傳統(tǒng)編譯型程序語(yǔ)言所PythonNanjingFlying455 Glue很容易和其他著名的程序語(yǔ)言連接(C/C++),集成封 Script高 語(yǔ)言, 語(yǔ)言只能處理簡(jiǎn)單任務(wù)強(qiáng)完全支持繼Nanjing66可移植可升級(jí)可擴(kuò)展健壯性解釋性編譯性易學(xué)易讀易高級(jí)面向?qū)ο驨anjing77
Nanjing88Python定義了WSGI標(biāo)準(zhǔn)應(yīng)用接口來(lái)協(xié)調(diào)http服務(wù)器與基于用wxPython或者PyQtNanjing99大多數(shù)Linux發(fā)布版以及NetBSD、OpenBSD和MacOSX都集成了Python,操作Python標(biāo)準(zhǔn)庫(kù)包含了多個(gè)調(diào)用系統(tǒng)可用于計(jì)算機(jī)游戲三 NanjingNanjingAlexMar 2002Activators’ChoiceAward和2006FrankWillisonaward為
DanielGreenfeld之前在宇航局做開(kāi)
Miguel NanjingPythonTheZenof。BeautifulisTheZenof。Explicitisbetterthanimplicit.Simpleisbetterthancomplex.Complexisbetterthancomplicated.Flatisbetterthannested.Sparseisbetterthandense.Readabilitycounts.Specialcasesaren'tspecialenoughtobreaktheAlthoughpracticalitybeatspurity.Errorsshouldneverpasssilently.Unlessexplicitlysilenced.Inthefaceofambiguity,refusethetemptationtoThereshouldbeone--andpreferablyonlyone--obviouswaytodoAlthoughthatwaymaynotbeobviousatfirstunlessyou'reNowisbetterthanAlthoughneverisoftenbetterthan*right*Iftheimplementationishardtoexplain,it'sabadIftheimplementationiseasytoexplain,itmaybeagoodidea.Namespacesareonehonkinggreatidea--let'sdomoreofthose!byTimNanjing用用PythonPYTHON omyString= o, printPythonPython3.x中NanjingS Nanjing在Pytho的DE環(huán)境中,創(chuàng)建一個(gè)以y用Python解釋器在 中運(yùn)行出結(jié)Nanjing o>>>myString= o,>>>printo>>> o# mystring= o,print>>>>>>myString= o>>>printoprint符>>>price=raw_input('inputthestockpriceofinputthestockpriceof>>>>>><typeNanjing#>>>#comment>>>print oo
#commentNanjing\>>>\>>>#long>>>if(signal=='red')and(car=='moving'):car='stop'elif(signal=='green')and(car=='stop'):car='moving'>>>#long>>>if(signal=='red')(car==car=elif(signal=='green')(car==car=Nanjing\>>>\>>>#triple>>>print'''hietopython’sMOOCcourse.Herewecanlearnsomethingaboutpython.Goodlucky!''' –三引號(hào)包括下的字;>>>x='Today';y='is';z='Thursday';print(x,y,z)('Today','is','Thursday')>>>x=>>>y=>>>z=>>>print(x,y,z)Nanjing
塊的開(kāi)
Python用 同的縮進(jìn)表同級(jí)別語(yǔ)句塊的退
>>>#>>>if(signal=='red')and(car==car='stop'singal='yellow'elif(signal=='green')and(car=='stop'):car='moving‘singal=Nanjing用用PythonPYTHON>>>#>>>p=>>>myString='isamathematiccircular>>>printp,3.14159isamathematiccircular>>>#>>>PI=>>>pi='one>>>print>>>print>>>#>>>PI=>>>pi='one>>>print>>>printone關(guān)鍵字是Python語(yǔ)言的關(guān)鍵組成部分,不可隨便作為其他對(duì)象的識(shí)IDE由Python2.x中的31個(gè)變?yōu)?3Nanjing非與或非與或<>~與&或|~與&或|^整 加 +>>>#>>>PI=>>>r=>>>c_circ=>>>print"Thecircle'scircum:%f"2*PI*r是表達(dá)式運(yùn)算結(jié)果賦值給變量=變量第一次賦=>>>#>>>PI=>>>#>>>PI=>>>pi='one>>>print>>>printone'one>>>>>>#>>>PI=>>>pi=>>>printPI>>>printpi
+=-=*=/=%=**=<<=>>=&=^=>>>#>>>m>>>#>>>m=>>>m%=>>>m>>>m**=>>>9m**=2mm**Nanjing>>>#>>>PI=pi=>>>>>>>>>#>>>PI=>>>pi=PI=PI*>>>>>>#>>>x=>>>y=>>>x,y(1,2)>>>x,y=y,>>>x,(2,>>>#>>>PI,r=3.14159,>>>PI>>>r>>>(PI,r)=(3.14159,3)#sameasnoroundNanjing賦值語(yǔ)句完成了賦print輸出語(yǔ)句完成了輸>>>#>>>PI=>>>r=>>>c_circ=>>>print"Thecircle'scircum:%f"如如,打印一份文如,這份文的具體內(nèi)用用PythonPYTHON 1001100100111001001110010011000010000000100010011011Nanjing
Nanjing>>>#>>><type>>>>>>#>>><type>>><typePython3.x中沒(méi)與Python2.x中整型值后加“L”即為長(zhǎng)整Nanjing
>>>#>>>x=>>>1>>>y=>>>0
>>>#>>>#>>>>>>>>>-4.78e-->>>type(-4.78e-<type>>>#>>>>>>#>>>>>><type>>>>>><type>>>>>><type>>>#>>>x=>>>>>>復(fù)數(shù)復(fù)數(shù)復(fù)數(shù)型
Nanjing
>>>myString= o>>>printmyStringoWorld!>>>myString= o>>>printo>>>myString= o>>>printoNanjing
>>>#>>>d>>>用用PythonPYTHON>>>>>>#>>>pi=>>>r=>>>circum=2*pi*>>>x=>>>y=>>>z=>>>result1=x+3/y-z%>>>result2=(x+18.849541–乘方**、正負(fù)、乘除*/、整除//、取余%、加減+>>>#>>>2==>>>2.46<=>>>'abc'==>>>'abc'>'xyz'>>>'abc'<'xyz'>>>#>>>3<4< #sameas(3<4)and(4<7>>>4>3==3#sameas(4>3)and(3==3>>>4<3<5!=Nanjing>>>#>>>x,y=>>>x<>>>not(x<>>>(x<5.0)or(y>>>>(x<5.0)and(y>>>>not(xisy),-))>>>3<4< #sameas"(3<4)and(4<7–not、and、 r–UnicodeuU
>>>#
–轉(zhuǎn)換成Unicode字符
>>>f=File #12>",line1,in
f=>>>#
IOError:[Errno22]invalidmode('w')filename:dprint do
>>>f=>>>f=Nanjing11234>>>#>>>3<2and2<1or5>>>>x+3/y-z%2>>>>3-2<<2>>>3-2<<1<Nanjing用用PythonPYTHON絕對(duì)值函數(shù)類(lèi)型函數(shù)四舍五入函數(shù)Nanjing
cmp()strtype()適用于所有標(biāo)準(zhǔn)類(lèi) NanjingNanjingimportNanjing>>>#round-off>>>>>>>>>>>><type>>>#round-off>>>>>>>>>>>><type>>>#round-off>>>Traceback(mostrecentcallFile #0>",line1,inNameError:name'floor'isnot
>>>#round-off>>>frommathimport>>>floor(-->>>floor(-->>>floor(--Nanjing>>>#>>>import>>>#>>>import>>>math.pim
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 電力行業(yè)智能電表應(yīng)用推廣方案
- 2024-2030年中國(guó)空穴傳輸材料行業(yè)營(yíng)銷(xiāo)策略及競(jìng)爭(zhēng)格局分析研究報(bào)告
- 2024-2030年中國(guó)稀有金屬礦行業(yè)市場(chǎng)發(fā)展分析及競(jìng)爭(zhēng)格局與投資前景研究報(bào)告
- 2024-2030年中國(guó)碳酸飲料行業(yè)市場(chǎng)發(fā)展分析及發(fā)展趨勢(shì)與投資前景研究報(bào)告
- 2024-2030年中國(guó)堿性膜清潔劑行業(yè)發(fā)展現(xiàn)狀與未來(lái)趨勢(shì)研究研究報(bào)告
- 2024-2030年中國(guó)真皮鞋底行業(yè)發(fā)展趨勢(shì)與投資戰(zhàn)略研究報(bào)告
- 2024-2030年中國(guó)監(jiān)護(hù)儀行業(yè)現(xiàn)狀及發(fā)展趨勢(shì)報(bào)告
- 2024-2030年中國(guó)皮箱行業(yè)市場(chǎng)發(fā)展分析及發(fā)展趨勢(shì)與投資研究報(bào)告
- 2024-2030年中國(guó)電蒸籠行業(yè)市場(chǎng)發(fā)展趨勢(shì)與前景展望戰(zhàn)略研究報(bào)告
- 2024-2030年中國(guó)電池包裝制品行業(yè)調(diào)研分析及發(fā)展趨勢(shì)預(yù)測(cè)研究報(bào)告
- 門(mén)式剛架輕鋼結(jié)構(gòu)廠(chǎng)房施工組織設(shè)計(jì)(80頁(yè))
- 主題宴會(huì)設(shè)計(jì)與管理實(shí)務(wù)任務(wù)4.4 主題宴會(huì)菜單設(shè)計(jì)某酒店喪宴菜單
- 工程勘察設(shè)計(jì)收費(fèi)管理規(guī)定解釋
- 民間非營(yíng)利組織會(huì)計(jì)報(bào)表模板
- 初三勵(lì)志主題班會(huì)教案
- 水池池體施工方案
- 華為交換機(jī)防ARP攻擊配置手冊(cè)
- 海氏和美世國(guó)際職位評(píng)估法
- 員工人事檔案記錄表(DOC6頁(yè))(正式版)
- 不動(dòng)產(chǎn)產(chǎn)權(quán)情況表
- 醫(yī)院核心制度執(zhí)行情況考核細(xì)則(總分50分).docx
評(píng)論
0/150
提交評(píng)論