Ask Your Question
1

saving multiple files

asked 2021-09-11 17:01:47 +0100

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-09-12 09:36:47 +0100

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}')
edit flag offensive delete link more

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: 2021-09-11 17:01:47 +0100

Seen: 561 times

Last updated: Sep 12 '21