欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

Python中oct()函數(shù)的語法-創(chuàng)新互聯(lián)

這篇文章主要介紹Python中oct()函數(shù)的語法,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

成都創(chuàng)新互聯(lián)公司主要從事成都網(wǎng)站設計、成都網(wǎng)站建設、網(wǎng)頁設計、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務。立足成都服務揚州,10多年網(wǎng)站建設經(jīng)驗,價格優(yōu)惠、服務專業(yè),歡迎來電咨詢建站服務:18982081108

什么是oct函數(shù)?

oct()函數(shù)是Python3中的內(nèi)置方法之一。 oct()方法采用整數(shù),并以字符串格式返回其八進制表示形式。

oct()語法如下:

Syntax : oct(x) #語法
 
Parameters :   #參數(shù)
 
x – Must be an integer number and can be in either binary, decimal or hexadecimal format.
#  x必須為整數(shù),并且可以為二進制,十進制或十六進制格式。
 
Returns : octal representation of the value.#返回值的八進制表示形式。
 
Errors and Exceptions :   #錯誤和異常:
TypeError : Returns TypeError when anything other than integer type constants are passed as parameters.
#TypeError:當將整數(shù)類型常量以外的任何內(nèi)容作為參數(shù)傳遞時,返回TypeError。

oct()函數(shù)的用法

print("The octal representation of 23 is " + oct(23))
print("The octal representation of the"
" ascii value of 'z' is " + oct(ord('z')))
print("The octal representation of the binary"
" of 23 is " + oct(0b10111))
print("The octal representation of the binary"
" of 23 is " + oct(0x17))

輸出:

The octal representation of 23 is 0o27
The octal representation of the ascii value of 'z' is 0o172
The octal representation of the binary of 23 is 0o27
The octal representation of the binary of 23 is 0o27

以上是Python中oct()函數(shù)的語法的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

網(wǎng)站欄目:Python中oct()函數(shù)的語法-創(chuàng)新互聯(lián)
網(wǎng)站路徑:http://www.chinadenli.net/article6/pcdig.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站網(wǎng)站排名搜索引擎優(yōu)化網(wǎng)站維護移動網(wǎng)站建設標簽優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

營銷型網(wǎng)站建設