当前位置: 首页 > 图灵资讯 > 行业资讯> python中等号是什么意思?

python中等号是什么意思?

发布时间:2026-04-08 15:34:19

python中的等号“=”是将“=”右侧的数据赋值给左侧的基本赋值运算符。可与算术运算符一起使用。

常用的赋值运算符使用方法:

示例:

In[1]:a=2;b=3
In[2]:c=a+b	#Out[3]:5	(以下c的初始值为5)
In[4]:c+=a		#Out[5]:7
In[6]:c-=a		#Out[7]:3
In[8]:c*=a		#Out[9]:10
In[10]:c%=a		#Out[11]:1	(结果为c除以a的余数)
In[13]:c/=a		#Out[14]:2.5
In[18]:c**=a	#Out[19]:25
In[21]:c//=a	#Out[22]:2	(结果为c除以a的除数)

请关注Python视频教程栏目,了解更多Python知识。

相关文章

python中等号是什么意思?

python中等号是什么意思?

2026-04-08
python找出几个数最大值的方法

python找出几个数最大值的方法

2026-04-08
python怎样删除字典中的元素

python怎样删除字典中的元素

2026-04-08
python怎么让代码无效

python怎么让代码无效

2026-04-08
python怎么设置小数点后保留两位小数点

python怎么设置小数点后保留两位小数点

2026-04-08
python怎么设置计时器

python怎么设置计时器

2026-04-07