private void button4_Click(object sender, EventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.Description = "请选择文件保存位置";
if (dialog.ShowDialog() == DialogResult.OK)
{
string foldPath = dialog.SelectedPath;
textBox3.Text = foldPath;
//DirectoryInfo theFolder = new DirectoryInfo(foldPath);
theFolder 包含文件路径
//FileInfo[] dirInfo = theFolder.GetFiles();
}
}
若与Python结合要在Python中写代码保存文件,则Python中加两句代码:
dataframe = pd.DataFrame(y_pred)
# 将DataFrame存储为csv,index表示是否显示行名,default=True
savePath = savePath + "\\MeanShift_result.csv"
dataframe.to_csv(savePath, header=False, index=False, sep=',')