我有一个使用多处理的单元测试。
从 Python 3.2 升级到 Python 3.4 后,出现以下错误。我找不到提示,Python 内部发生了什么变化以及我必须改变什么才能使我的代码运行。
提前致谢。
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python341_64\lib\multiprocessing\spawn.py", line 106, in spawn_main
exitcode = _main(fd)
File "C:\Python341_64\lib\multiprocessing\spawn.py", line 116, in _main
self = pickle.load(from_parent)
EOFError: Ran out of input
Error
Traceback (most recent call last):
File "D:\test_multiproc.py", line 46, in testSmallWorkflow
p.start()
File "C:\Python341_64\lib\multiprocessing\process.py", line 105, in start
self._popen = self._Popen(self)
File "C:\Python341_64\lib\multiprocessing\context.py", line 212, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Python341_64\lib\multiprocessing\context.py", line 313, in _Popen …Run Code Online (Sandbox Code Playgroud) 可能重复:将
字符串拆分为Python中的列表
我有一个包含很多部分字符串的字符串
>>> s = 'str1, str2, str3, str4'
Run Code Online (Sandbox Code Playgroud)
现在我有一个像下面这样的功能
>>> def f(*args):
print(args)
Run Code Online (Sandbox Code Playgroud)
我需要的是将我的字符串分成多个字符串,以便我的函数打印出这样的东西
>>> f(s)
('str1', 'str2', 'str3', 'str4')
Run Code Online (Sandbox Code Playgroud)
有人有想法,我怎么能这样做?
这是我搜索的内容.
>>> s = s.split(', ')
>>> f(*s)
('str1', 'str2', 'str3', 'str4')
Run Code Online (Sandbox Code Playgroud)