我得到错误
TypeError: cannot concatenate 'str' and 'Set' objects
错误是我的代码引起的
name=inst1name+'-'+setName
我知道问题是:
inst1name
是一个设置对象,但是在运行脚本之前,永远不会出现此错误。你知道为什么吗以及我该如何解决?
最佳答案
您可以像这样将set
显式转换为其字符串表示形式:
name = inst1name + '-' + str(setName)
但是更好的方法是使用像这样的字符串组合:
name = '%s-%s' % (inst1name, setName)
甚至像这样的
string.format
:name = '{}-{}'.format(inst1name, setName)
关于python - abaqus脚本: TypeError: cannot concatenate 'str' and 'Set' objects,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25425265/