First time here? Check out the FAQ!

Ask Your Question
1

saving multiple files

asked 3 years ago

kinchocobo gravatar image

Can I save results from a series of computations separately? Like

for i in RANGE: CODE

save(result, 'filename_i')

?

I can make a list of results and save it in one file, but sometimes I prefer separate files.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 3 years ago

slelievre gravatar image

This can be done.

The only thing you need is a way to include the number in the filename.

Formatted strings can help with that:

save(result, f'filename_{i}')
Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 3 years ago

Seen: 728 times

Last updated: Sep 12 '21