日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
創(chuàng)新互聯(lián)Python教程:Python教程:int()函數(shù)的用法解析

Python中的函數(shù)有很多,之前我們有講過(guò)int()函數(shù),今天就具體用法給大家進(jìn)行講解。

創(chuàng)新互聯(lián)專業(yè)為企業(yè)提供圖們網(wǎng)站建設(shè)、圖們做網(wǎng)站、圖們網(wǎng)站設(shè)計(jì)、圖們網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、圖們企業(yè)網(wǎng)站模板建站服務(wù),十年圖們做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。

int()是Python的一個(gè)內(nèi)部函數(shù) ,Python系統(tǒng)幫助里面是這么說(shuō)的。

>>> help(int)  
Help on class int in module __builtin__:  
class int(object)  
 | int(x[, base]) -> integer  
 |   
 | Convert a string or number to an integer, if possible. A floating point  
 | argument will be truncated towards zero (this does not include a string  
 | representation of a floating point number!) When converting a string, use  
 | the optional base. It is an error to supply a base when converting a  
 | non-string. If base is zero, the proper base is guessed based on the  
 | string content. If the argument is outside the integer range a  
 | long object will be returned instead.  
>>> int(12.0)  
12


int()函數(shù)可以將一個(gè)數(shù)轉(zhuǎn)化為整數(shù)

>>> int('12',16)  
18


這里有兩個(gè)地方要注意:

1)12要以字符串的形式進(jìn)行輸入,如果是帶參數(shù)base的話

2)這里并不是將12轉(zhuǎn)換為16進(jìn)制的數(shù),而是說(shuō)12就是一個(gè)16進(jìn)制的數(shù),int()函數(shù)將其用十進(jìn)制數(shù)表示,如下


>>> int('0xa',16)  
10 
>>> int('10',8)  
8

對(duì)int()函數(shù)有遺忘的,可以查詢之前的文章進(jìn)行知識(shí)回顧。更多Python學(xué)習(xí)推薦:PyThon學(xué)習(xí)網(wǎng)教學(xué)中心。

(推薦操作系統(tǒng):windows7系統(tǒng)、Python 3.9.1,DELL G3電腦。)


網(wǎng)頁(yè)題目:創(chuàng)新互聯(lián)Python教程:Python教程:int()函數(shù)的用法解析
網(wǎng)址分享:http://www.5511xx.com/article/cdjeieh.html