[問題] Print matrix formatting problem

看板Python作者 (Mark)時間14年前 (2011/09/29 23:28), 編輯推噓0(002)
留言2則, 2人參與, 最新討論串1/3 (看更多)
I can't type Chinese in the computer now. Sorry蔊The following is my output if I print a matrix (I used numpy) from a generated m*n matrix. But I want to generate/print a tab delimited file for reading/opening excel. Could anybody provide a clever solution? Thanks! [[ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] [ 0. 1. 0. 0. 0. 1. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1.] [ 0. 0. 4. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0.] [ 1. 0. 0. 0. 0. 0. 0. 1. 0. 1. 0. 0. 1. 0. 1. 0. 0. 1. 0. 0. 1. 1. 0. 0. 0. 0.] [ 0. 0. 0. 1. 0. 0. 0. 0. 1. 0. 3. 0. 0. 1. 0. 1. 0. 0. 1. 0. 0. 0. 1. 0. 0. 0.] [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0.] [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0.] [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0.] [ 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]] -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 69.173.98.169

09/29 23:39, , 1F
我記得python可以用win32com.client讀寫excel檔
09/29 23:39, 1F

09/29 23:43, , 2F
開個txt或csv的檔案寫進去就行了
09/29 23:43, 2F
文章代碼(AID): #1EX8wAcd (Python)
文章代碼(AID): #1EX8wAcd (Python)