json2Excel

json2Excel

mathematica 中可以导入和导出
其中支持json文件的导入和导出

  • 代码格式
Import["formathematica.json"]

对于实际使用中需要添加文件路径

Import["D:\\金蟾去哪出鱼配置\\各方间配置json\\普通房\\formathematica.json"]

文件路径中注意使用双反斜杠

  • 导入结果
    导入结果

此时只是表示文档被导入

  • 文档格式化
m = TableForm[%13[[All, All, 2]], 
  TableHeadings -> {None, %13[[1, All, 1]]}]

这里的m为中间量,将表格暂时赋值给m,也可以省略“m=”

表格化结果
表格化结果

  • 导出为Excel
Export["D:\\example.xls", m, "XLS"]

参数项依次为: 文件名称(含路径),导出数据,文件格式(后缀名)

  • 导出结果

Excel导出结果
Excel导出结果

结果与mathematica端显示的差距有

  1. 大括号的添加
  2. 表头的缺省
  • 改进方向

猜你喜欢

转载自www.cnblogs.com/yuvejxke/p/11243956.html