我有一個文本文件,其中包含以適合查看但不適合編程處理的方式打印的數據。這是因爲它使用白色空格作爲分隔符,並且行中有空白條目,但我沒辦法想到區分它們。這就是爲什麼我在這裏提出問題。從Matlab中的文本文件中讀取的數據沒有以一致的方式進行分隔
實施例文件內容:
Bend Machine Information
========================
Bend # Offset Twist Angle Bend Angle Bend Radius
-------- -------------- -------------- -------------- --------------
1 147.17 13.39 31.75
2 116.11 180.00 13.39 31.75
3 199.92 305.13 90.00 31.75
4 0.10 0.00 90.00 31.75
5 68.75
文件結束。
所以在上面的文字中有扭轉角列第一行的條目,但空格並不表示。
有關如何解析此問題的任何想法? 我想使用Matlab,但也可能使用其他語言(如Perl或Python)。
在此先感謝。