how to add a ndarray to a text file ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to add a ndarray to a text file ??

adding an array to a txt file.any method??

11th Jun 2018, 11:05 AM
Aju George
Aju George - avatar
6 Answers
+ 2
ok, try to convert your array to string: use the str(yourndarray) method. if that doesn’t work post the relevant code from your project and let me see what youre trying to do exactly.
11th Jun 2018, 12:45 PM
Umair Salam
Umair Salam - avatar
+ 1
Hi Aju i don’t know what you mean exactly. From what i understand, take a look at the loadtext function from numpy: https://docs.scipy.org/doc/numpy-1.14.0/reference/generated/numpy.loadtxt.html
11th Jun 2018, 12:26 PM
Umair Salam
Umair Salam - avatar
0
hi Umair Salman .. i just need to save my array to a text file
11th Jun 2018, 12:36 PM
Aju George
Aju George - avatar
0
it is not working for arra. it shows an error like only string is posssible to write.
11th Jun 2018, 12:43 PM
Aju George
Aju George - avatar
0
ok thanku
11th Jun 2018, 12:46 PM
Aju George
Aju George - avatar