3

I'd like to specify a filename based on a different id number. How can I set different a file name according to a different id value?

id = args.bdp_id
filename = "./temp/vtx_vel%d.dat", id
print (filename)

2 Answers 2

3

See string.format if you want to use sprintf style substitutions:

filename = string.format("./temp/vtx_vel%d.dat", id)
Sign up to request clarification or add additional context in comments.

Comments

3

You can do it like this:

filename ="./temp/vtx_vel"..id..".dat"

Comments

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.