这是我的代码。不仅在此代码中,在我导入任何模块的每个代码中,ImportError:无法导入名称“包名称”都会显示
from string import maketrans
str = "geeksforgeeks"
str1 = "gfo"
str2 = "abc"
# using maktrans() to map elements of str2 with str1
mapped = maketrans(str1, str2);
# using translate() to translate using the mapping
print"The string after translation using mapped elements is : "
printstr.translate(mapped);
答案 0 :(得分:0)
最后一行应该是
print str.translate(mapped)
不是
printstr.translate(mapped);
您可以在终端中运行此命令并发布输出
which -a python