新聞中心
說(shuō)明

網(wǎng)站建設(shè)公司,為您提供網(wǎng)站建設(shè),網(wǎng)站制作,網(wǎng)頁(yè)設(shè)計(jì)及定制網(wǎng)站建設(shè)服務(wù),專注于企業(yè)網(wǎng)站建設(shè),高端網(wǎng)頁(yè)制作,對(duì)混凝土攪拌罐車等多個(gè)行業(yè)擁有豐富的網(wǎng)站建設(shè)經(jīng)驗(yàn)的網(wǎng)站建設(shè)公司。專業(yè)網(wǎng)站設(shè)計(jì),網(wǎng)站優(yōu)化推廣哪家好,專業(yè)成都網(wǎng)站營(yíng)銷優(yōu)化,H5建站,響應(yīng)式網(wǎng)站。
1、在執(zhí)行python代碼時(shí),在Python解釋器用四個(gè)過(guò)程“拆解”我們的代碼,最終被CPU執(zhí)行返回給用戶。
2、當(dāng)用戶鍵入代碼交給Python處理的時(shí)候會(huì)先進(jìn)行詞法分析,例如用戶鍵入關(guān)鍵字或者當(dāng)輸入關(guān)鍵字有誤時(shí),都會(huì)被詞法分析所觸發(fā),不正確的代碼將不會(huì)被執(zhí)行。
實(shí)例
#!/usr/bin/env python
import re
from time import ctime
def run():
pattern='case'
rere_obj=re.compile(pattern)
infile=open('/etc/rc.subr','r')
match_count=0
lines=0
for line in infile:
match=re_obj.search(line)
if match:
match_count+=1
lines+=1
return (lines,match_count)
if __name__=='__main__':
print('starting at:',ctime())
lines,match_count=run()
print "LINES:",lines
print "MATCHS:",match_count
print('ending at:',ctime())Python代碼中編譯的介紹,通過(guò)結(jié)尾的例子,我們可以看出編譯后代碼的性能是比較好的。大家學(xué)會(huì)后也趕快用起來(lái)吧。更多Python學(xué)習(xí)指路:創(chuàng)新互聯(lián)Python教程
本文教程操作環(huán)境:windows7系統(tǒng)、Python 3.9.1,DELL G3電腦。
新聞標(biāo)題:創(chuàng)新互聯(lián)Python教程:Python代碼中編譯是什么
文章來(lái)源:http://www.dlmjj.cn/article/cdsjppc.html


咨詢
建站咨詢
