beim Umstellen von Python2 auf Python3 hatte ich vergessen das string.atoi nicht mehr geht.
Code: Alles auswählen
try :
import sys
print("PythonVersion = " + sys.version)
version = "1.0.0.1"
m=map(string.atoi,version.split("."))
except Exception as error:
print("Exception: " , error, type(error))
PythonVersion = 3.9.9 (tags/v3.9.9:ccb0e6a, Nov 15 2021, 18:08:50) [MSC v.1929 64 bit (AMD64)]
Exception: module 'string' has no attribute 'atoi' <class 'AttributeError'>
Wenn ich das gleiche in der Idle-Shell 3.9.9 ausführe, liefert es:
PythonVersion = 3.9.9 (tags/v3.9.9:ccb0e6a, Nov 15 2021, 18:08:50) [MSC v.1929 64 bit (AMD64)]
Exception: name 'string' is not defined <class 'NameError'>
Kann mir bitte jemand sagen, warum sich hierbei die Klasse der Exception von AttributeError auf NameError ändert?
Vielen Dank im voraus!