【发布时间】:2019-04-16 00:22:17
【问题描述】:
我需要编写一个 STL 文件,然后在一个脚本中解析它,所有这些都在一个可共享的 python 笔记本的 mybinder.org 实例中。这可能吗?
【问题讨论】:
标签: python docker jupyter-notebook
我需要编写一个 STL 文件,然后在一个脚本中解析它,所有这些都在一个可共享的 python 笔记本的 mybinder.org 实例中。这可能吗?
【问题讨论】:
标签: python docker jupyter-notebook
我只是自己尝试了一下,所有需要做的。 可能是糟糕的做法,但很实用。
import os
cwd = os.getcwd() # gets directory of docker environment
sys.path.append(cwd)
testfile = cwd + '/testfile.txt'
with open(testfile, 'w') as tf:
tf.write('Hello World')
with open(testfile, 'r') as tf2:
print(tf2.read())
【讨论】: