早教吧作业答案频道 -->其他-->
python报错TypeError:anintegerisrequired运行re.sub('X','Mr','Smith','attn:X\n\nDearX,\n')提示如下错误:Traceback(mostrecentcalllast):File"",line1,inre.sub('X','Mr','Smith','attn:X\n\nDearX,\n')File"D:\Pyehon273\lib\re.py",l
题目详情
python 报错TypeError:an integer is required
运行 re.sub('X','Mr','Smith','attn:X\n\nDear X,\n')
提示如下错误:Traceback (most recent call last):
File "",line 1,in
re.sub('X','Mr','Smith','attn:X\n\nDear X,\n')
File "D:\Pyehon2_7_3\lib\re.py",line 151,in sub
return _compile(pattern,flags).sub(repl,string,count)
TypeError:an integer is required
运行 re.sub('X','Mr','Smith','attn:X\n\nDear X,\n')
提示如下错误:Traceback (most recent call last):
File "",line 1,in
re.sub('X','Mr','Smith','attn:X\n\nDear X,\n')
File "D:\Pyehon2_7_3\lib\re.py",line 151,in sub
return _compile(pattern,flags).sub(repl,string,count)
TypeError:an integer is required
▼优质解答
答案和解析
参数写错了,第四个参数count是integer的
sub( pattern, repl, string[, count])
sub( pattern, repl, string[, count])
看了 python报错TypeEr...的网友还看了以下:
圆的周长公式=C=πd=2πr≈6.28r圆的面积公式=S=π×r×r(以此类推,半圆的周圆的周长 2020-04-12 …
R&D人员折合全时当量是指( )A.参加R&D项目人员的全时当量B.分摊在参加R&D项目的管 2020-05-21 …
R&D人员折合全时当量是指( )A.参加R&D项目人员的全时当量B.分摊在参加R&D项目的管理和直接 2020-05-30 …
函数的概念问题高等数学里面,函数的定义是:设集数D包含于R,则称映射f:D→R为定义在D上的函数… 2020-06-08 …
为什么两圆相交R+r>d>R-r怎么证明 2020-06-09 …
阅读材料,完成下列要求。材料一我国2012~2015年规模以上工业企业R&D经费情况项目年份201 2020-07-09 …
下面的方程组能否求解?cos(a+b)=m,cosa=r1/r,cosb=r2/r其中:m、r、s 2020-07-19 …
什么是二项式的通式?在二项式定理(a+b)^n=C(n,0)a^n+C(n,1)a^(n-1)b+ 2020-07-31 …
关于圆内含R-r>d和R-r 2020-12-02 …
设关系模式R(ABCD),F={A→BC,B→C,C→D}.(1)R的候选关键字是什么(2)情说明R 2020-12-25 …