0

Arrays & Text-files

So I have that function that outputs an array. I'd like to ask how do I save said function on a text-file for then calling that array back to further iterate it and save it back again. And the cycle goes on.

25th Sep 2018, 5:43 PM
Hakim
Hakim - avatar
3 odpowiedzi
+ 1
So when you say "save said function" you mean you want to save the array which is the result of the function right ? If you're just interested in the result (so you want a simple solution that works for numbers, very well by the way) you can use the library numpy (a must know for data scientists using Python) : https://docs.scipy.org/doc/numpy-1.14.5/reference/generated/numpy.save.html If you're interested in creating your own function, it would involve opening, reading and writing in files. It would mean creating your custom made "tokenizer". A very good exercise imo. If that's what you're looking for, I would be glad to help
25th Sep 2018, 6:09 PM
dhm
+ 2
If all you want to do is saving some data to a text file, you don't need numpy or even some import from the standard library. The link down there leads to a description of basic read and write functions. https://www.pythonforbeginners.com/files/reading-and-writing-files-in-JUMP_LINK__&&__python__&&__JUMP_LINK
25th Sep 2018, 11:46 PM
HonFu
HonFu - avatar
0
Thank you dhm, what I wanted to do seems like a tokenizer.
25th Sep 2018, 9:57 PM
Hakim
Hakim - avatar