Python 我已经为simulateBeamRun编写了代码,当我运行它时,它会说我有语法错误
这是我创建的代码,当我运行它时,在IPython控制台中输入时,我得到语法错误:Python 我已经为simulateBeamRun编写了代码,当我运行它时,它会说我有语法错误,python,Python,这是我创建的代码,当我运行它时,在IPython控制台中输入时,我得到语法错误: import beamModel import personModel def createPersonList(fileName): """Function will go through each line of file and create a person object using the data provided in the line and add it to a li
import beamModel
import personModel
def createPersonList(fileName):
"""Function will go through each line of file and
create a person object using the data provided in
the line and add it to a list
"""
theFile = open(fileName)
next(theFile)
for line in theFile:
aList = line.split(',')
bList = map(lambda s: s.strip('\n'), aList)
cList = [float(i) for i in bList]
return cList
def simulateBeamRun(personList, beam, times):
"""Takes a list of times covering the duration of
the simulation (0-35 s), the list of person
objects and a beam object to simulate a beam run
"""
ps = personList
b = beam
ts = times
dList = []
for time in ts:
eList = []
if ps is None:
return "No values in personList"
else:
for person in ps:
loadTuples = personModel.person.loadDisplacement(time)
if beamModel.b.L > loadTuples[1] > 0:
eList.append(loadTuples)
else:
return None
beamModel.b.setLoads(eList)
dList.append(beamModel.b.getMaxDeflection())
return (dList, eList)
b=beamModel.beam(8.0E9,1.333E-4,5.0)
ps=createPersonList(“personData.csv”)
ts=numpy.linspace(0,35500)
打印模拟跑步(个人列表、光束、时间)
文件“”,第1行
打印模拟跑步(个人列表、光束、时间)
^
SyntaxError:无效语法
打印时没有括号-python 2?谢谢,但它是spyder python 3.7
b = beamModel.beam(8.0E9, 1.333E-4, 5.0)
ps = createPersonList("personData.csv")
ts = numpy.linspace(0,35,500)
print simulateBeamRun(personList, beam, times)
File "<ipython-input-18-63875d960559>", line 1
print simulateBeamRun(personList, beam, times)
^
SyntaxError: invalid syntax