1

I have an empty string strLocation and I would like to insert the three variables x, y and z to make the string a location of a point which is (x,y,z). I know I cannot simply add 'x' 'y' and 'z' because that will just add the letters instead of the actual values they hold. What should I do?

2

2 Answers 2

4
str_location = '({0}, {1}, {2})'.format(x, y, z)
Sign up to request clarification or add additional context in comments.

Comments

2

Something like

 strLocation = "("+str(x)+","+str(y)+","+str(z)+")"

?

2 Comments

@Kroltan It doesn't, see this question for someone having that problem.
@SuperBiasedMan Thanks for the reference. Been using Javascript for too long :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.