我一直在努力寻求一个简单的问题.我想将Spotfire的值(字符串/实数/字符串列表)输出到计算机上的文本文件中.我的最终解决方案将需要列出和保存文档属性,但现在让我们使用来自stackoverflow的有效脚本:是否可以使用IronPython将当前* .dxp项目的路径作为字符串返回?
I have been struggling with something I hope to be a simple question. I would like to output values (String / Real / Stringlist) from Spotfire to a text file on my computer. My final solution would need document properties to be listed and saved, but for now let's use a working script from stackoverflow: Is it possible to use IronPython to return the path of the current *.dxp project as a string?
两个变量:路径"和分析"被打印".如何将它们打印到文本文件?
Two variables: path and analysis are 'printed'. How can I print those to a text file?
类似的操作在这里完成: spotfired.blogspot.co.uk/2014/04/export-image-from-visualization.html ,其中将创建.bmp图像.
Something similar is done here: spotfired.blogspot.co.uk/2014/04/export-image-from-visualization.html where a .bmp image is created.
非常感谢,
推荐答案写入文件不是IronPython独有的. Python文档对此进行了很好的介绍.无论如何:
writing to a file isn't unique to IronPython; the Python docs go over this fairly well. in any case:
f = open('c:\\filename.txt', 'w') f.write(path) f.write(analysis) my_list = ['one','two','three'] for item in my_list: f.write(item) # write the item's content f.write('\n') # add a line break (optional) f.close()你会没事的.
IronPython是常规Python的派生产品,可以与.NET API(例如Spotfire的API)进行交互.因此,通常您可以通过查看Python资源找到非Spotfire专用的解决方案.
IronPython is a derivative of regular Python that can interact with .NET APIs such as Spotfire's API. thus, you can typically find non-Spotfire-specific solutions by looking at Python resources.
更多推荐
将Spotfire的“打印"输出到文本文件
发布评论