我收到“ NameError:名称'MemoryStream'未定义”。我想念什么吗?
我的代码从这里开始:
from System.IO import Path, File, StreamWriter
from Spotfire.Dxp.Application.Visuals import VisualContent
import System.IO
vc=Visuals.As[VisualContent]()
memStream = MemoryStream();
sWriter = StreamWriter(memStream);
vc.ExportText(sWriter);
sReader = StreamReader(memStream);
memStream.Seek(0, SeekOrigin.Begin);
filename="C:\Users\Documents\TEST.csv"
f=open(filename,"w")
counter=0
j=0
str1=''
while (sReader.Peek()>=0):
line=[]
counter=counter+1
a=sReader.ReadLine()
lines=a.split("\t")
for elem in lines:
j=j+1
print elem
if str(elem).find(",")<>-1:
elem='"'+elem+'"'
line.append(elem)
str1 = ','.join(str(e) for e in line)
f.write(str1+'\n')
f.close();
sReader.Close()
Visuals =用于表/跨表可视化的脚本参数
将数据导出到Memory Stream并以逗号分隔的文本导出数据