程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Do you know all these Python tips?

編輯:Python

CDA Data Analyst Produce

author :CDA The star lecturer Cao Xin

edit :Mika

Python To the power of

http://mpvideo.qpic.cn/

Power at Python What to do inside , We may want to say whether to use 2^3 You can find the power , It's not .

This is in Python There is a bitwise XOR budget , It is related to binary , We know it's not meant to do power operations ok 了 .

The actual result is 1.

The real power is 2 individual **,1 individual * It's a ride .

2 individual ** Is to find the power ,2 The third power of is 8.

You must remember this .

Python The maximum value of a floating-point number http://mpvideo.qpic.cn/

Sometimes we use the maximum value of a floating-point number , So in Python How to get it inside ?

First of all import sys This package ,import After that , use sys. Inside float_info, Then use its max This function .

In this way, you can get the maximum value of the floating-point number , Have you learned ?

Python The infinity of floating point numbers

http://mpvideo.qpic.cn/

stay Python You want to get the infinity of floating point numbers in , How to get it ?

We directly float , Add a inf Namely infinity Abbreviation for Infinity , In this way, we can obtain the infinity of floating point numbers .

Come and try it , You will know when you need it


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved