Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 0 0
- 0 0 1
- 0 0 1
- 1 0 0
- 0 0 1
- 0 0 1 0
- def addTo(array,textFile):
- file=open(textFile,'ab')
- (numRows,numColumns)=array.shape
- main=array[0:numRows-1,:]
- endRow=array[numRows-1,:]
- newEndRow=np.append(endRow, [0])
- np.savetxt(file,main, fmt='%10.5f', newline=os.linesep)
- np.savetxt(file,newEndRow, fmt='%10.5f', newline=os.linesep)
- file.close()
- addTo(np.eye(3),'test1.txt')
- 1.00000 0.00000 0.00000
- 0.00000 1.00000 0.00000
- 0.00000
- 0.00000
- 1.00000
- 0.00000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement