将Spotfire的“打印"输出到文本文件 [英] Output Spotfire 'print' to text file

查看:68
本文介绍了将Spotfire的“打印"输出到文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力寻求一个简单的问题.我想将Spotfire的值(字符串/实数/字符串列表)输出到计算机上的文本文件中.我的最终解决方案将需要列出和保存文档属性,但现在让我们使用来自stackoverflow的有效脚本:

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?

类似的操作在这里完成: http://spotfired.blogspot.co.uk/2014/04/export-image-from-visualization.html ,其中将创建.bmp图像.

Something similar is done here: http://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的“打印"输出到文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆