我在Jupyter的笔记本上工作.我想在一个单元格中打开一个KML文件,然后在下一个单元格中进行一些分析. Select 文件后,第一个单元格具有:
# Print the selected path, filename, or both
print(fc.selected_path)
print(fc.selected_filename)
print(fc.selected)
global mytext
with open(fc.selected, 'r') as f:
print(f.read())
mytext = f.read()
这将按预期打印出文件的内容.
在下一个单元格中,我试图打印出我的文本,但得到一个空字符串.
如何将文件内容传递给下一个单元格中的My Text变量?