注册 登录
编程论坛 Python论坛

type(old_str)==types.IntType 什么错误

shop12365com 发布于 2022-07-13 17:14, 1169 次点击
old_str=3
if type(old_str)==types.IntType:
  print("")

 
Traceback (most recent call last):
  File "C:/Users/Administrator/Desktop/111.py", line 2, in <module>
    if type(old_str)==types.IntType:
NameError: name 'types' is not defined


python 3.8.10下,书上程序中,intType也不行
4 回复
#2
chen10242022-07-13 17:48
‘types’没定义
#3
shop12365com2022-07-13 18:27
types.IntType如何写  类型
#4
wp2319572022-07-14 09:10
回复 3楼 shop12365com
# 需要导入模块: from schematics import types [as 别名]
# 或者: from schematics.types import IntType [as 别名]
#5
gelid2022-07-15 21:36
共同學習
1