二進位的 0000 0100 0000 0011 0000 0010 0000 0001
(8*4 = 32個0或1,最前面5個0可以省略,剩下27位數)
是十進位的多少? ans: 67305985
1.手工算: =1*2^26+1*2^17+1*2^16+1*2^9+1*2^0 = 67305985
2.用小算盤:
程式設計人員 => 位元切換鍵台:

除了十進位demical (python無前綴)
八進位octal (python前綴0o,數字+英文字母)
十六進位hexadecimal(python前綴0x)
也一併算出來了
3. Python前綴0b 或0B (第一個為阿拉伯數字):
0b00000100000000110000001000000001

用python驗算小算盤的8進位跟16進位:
8進位( 0o400601001 ,第二個字母O可大寫)
16進位( 0x4030201 ,第二個字母X可大寫)

十進位的67305985是2進位的多少?
用bin()函數:

前面的5個0都去掉,所以位數比較少
十進位的67305985是
8進位(oct函數)
16進位(hex函數)的多少?

十進位轉為2,8,16進位:

2,8,16進位轉為10進位:

“0xff” (str)與 0xff (int)

推薦hahow線上學習python: https://igrape.net/30afN
![Python: pandas.DataFrame串接; pandas.concat( [df1,df2] , axis=1, ignore_index=True) ; .append() 產生一個新的DataFrame; 插入欄 .insert() 改變原DataFrame Python: pandas.DataFrame串接; pandas.concat( [df1,df2] , axis=1, ignore_index=True) ; .append() 產生一個新的DataFrame; 插入欄 .insert() 改變原DataFrame](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2022/11/20221129145451_29.png?quality=90&zoom=2&ssl=1&resize=350%2C233)



![Python struct.pack() 將整數轉換為bytes ; while list: str1=list[0] ; 中間內容; list=[1:] #切片 ,遍歷list中的每一個元素,跟for i in list 類似 ; timeit() #計時 Python struct.pack() 將整數轉換為bytes ; while list: str1=list[0] ; 中間內容; list=[1:] #切片 ,遍歷list中的每一個元素,跟for i in list 類似 ; timeit() #計時](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2022/10/20221012095050_42.png?quality=90&zoom=2&ssl=1&resize=350%2C233)





近期留言