a = string.split("Test Test2 Test3"," ")
这会返回一个错误:
Message File Name Line Position
Traceback
<module> C:\pyWiz.py 43
AttributeError: 'module' object has no attribute 'split'
是的,我导入了字符串模块。 为什么会这样?
请您参考如下方法:
使用:
a = 'Test Test2 Test3'.split(' ')
(即 str 类型的 split 方法)。 string.split 在 2.x 中被弃用并在 3.x 中消失。
