Python基礎資料型別 (Elementary Data Type) day2

來源:互聯網
上載者:User

標籤:ccf   exp   open   round   start   機器   type   python3   images   

運算子                                                                                              

1、算數運算:

2、比較運算:

3、賦值運算:

4、邏輯運算:

5、成員運算:

 1 name = "yehaoran "     # in  判斷ye是否在name裡面 在的話返回ok 不在返回not 2 # if "ye" in name : 3 #     print("ok") 4 # else: 5 #     print("not") 6  7 if "ran" not in name: 8     print("ok") 9 else:10     print("not")   #  in not  判斷ran是否在不name裡面 不在的話返回ok 在返回not
成員運算

 基礎資料型別 (Elementary Data Type)                                                                                                         

 1、數字

int(整型)

  在32位機器上,整數的位元為32位,取值範圍為-2**31~2**31-1,即-2147483648~2147483647
  在64位系統上,整數的位元為64位,取值範圍為-2**63~2**63-1,即-9223372036854775808~9223372036854775807
 1 #  數字 int 2 # python3裡,1111111111111122333數字多長都用int 3 # python2裡,數字太大用long小的用int 4  5 # 1、將字串轉換成數字    type 查看資料類型 6 # a = "123" 7 # print(type(a)) 8 # b = int(a ) 9 # print(type(b))10 # b = b + 10011 # print(b)12 13 14 # 2、以16進位的形式轉換成10進位15 # num = "a"16 # v = int(num, base=16)17 # print(v)18 19 20 # 3、當前數位二進位,至少用n位表示21 # # a = 12322 # # r = a.bit_length()23 # # print(r)
int幾種用法

 

 

Python基礎資料型別 (Elementary Data Type) day2

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.