#coding=utf8 def integerType(): ''' 布爾型: 該值的取值范圍只有兩個值:True(1)、False(0) ''' Tbool=True Fbool=False PRint "The True is stand for %d" %(Tbool) print "The False is stand for %d" %(Fbool) print ''' python標準整數(shù)類型: Python標準整數(shù)類型是最通用的數(shù)字類型。 在大多數(shù)32位機器上,標準整數(shù)類型的取值范圍:-2147483648 到 2147483647 Python標準整數(shù)類型等價于C的有符號長整型。 八進制整數(shù)以數(shù)字“0”開始。 十六進制整數(shù)以“0x”或“0X”開始 ''' bInt=010101 dInt=84455555 oInt=075 hInt=0xabc print "The binary of the standard integer:",bInt print "The decimal of the standard integer:",dInt print "The octal of the standard integer:",oInt print "The hexadecimal of the standard integer:",hInt print ''' python長整型: Python長整型能表達的數(shù)值僅僅與機器值的(虛擬)內(nèi)存大小有關(guān)。 長整數(shù)類型是標準整數(shù)類型的超集。 在一個整數(shù)值后面加上個L(大寫或小寫都可以,推薦使用大寫,避免和數(shù)字1混淆),表示這個整數(shù)時長整數(shù)。 這個整數(shù)可以是十進制、八進制、十六進制。 只有對長整數(shù)調(diào)用repr()才有機會看到L,對長整數(shù)調(diào)用str()看不到L。 整型和長整型正在統(tǒng)一為一種。 ''' bLong=0111111111111111111111111111111111111111111111L dLong=8888888888888888888888888888888888888888888888L oLong=0777777777777777777777777777777777777777777777L hLong=0XFFFFFFFFFFFFFFFFFAAAAAAAAAAAAABBBBBBBBBB78L print "The binary of the long integer:",repr(bLong) print "The decimal of the long integer:",repr(dLong) print "The octal of the long integer:",repr(oLong) print "The hexadecimal of the long integer:",repr(hLong) print '''call the function : integerType()'''integerType()
新聞熱點
疑難解答