Hi, there

I have the code (from Jice) using List below

targetlines=["*beam section,section=%s, elset=%s, material=%s",
                         "%s",
                         "%f, %f, %f"]

 resultlines=[targetlines[0] % (dResult['SEC'],section_type,mat_data),
                     targetlines[1] %  section_data,
                     targetlines[2] % (math.sin(float(dResult['ANG'])*math.pi/180),
                                               math.cos(float(dResult['ANG'])*math.pi/180),
                                               0)]

, which worked well

However when I modified it to

targetlines=["*element,type=b31, elset=%s",
                     "%s",
                     "*beam section,section=%s, elset=%s, material=%s",
                     "%s",
                     "%f, %f, %f"]

  resultlines=[targetlines[0] % dResult['SEC'],
                      targetlines[1] % (section_type,dResult['SEC'],mat_data),
                      targetlines[2] % line1b,
                       targetlines[3] % section_data,
                      targetlines[4] % (math.sin(float(dResult['ANG'])*math.pi/180),
                                               math.cos(float(dResult['ANG'])*math.pi/180),
                                               0)]

I got error below
"resultlines=[targetlines[0] % dResult,
TypeError: not all arguments converted during string formatting"

I cannot understand why as I already had value of dResult.

Could you please give some clue about it? Thank you a lot.

regards

ning

Recommended Answers

All 2 Replies

you inverted targetlines[1] and targetlines[2]

you inverted targetlines[1] and targetlines[2]

Hi, Jice

I am too old to make codes. Have a nice weekend.

ning

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.