python - 在 Jupyter 中由 Python 创建 .txt 文件的问题
问题描述
开始使用 Python 文件访问。我正在尝试用 Python 编写文件,但在文件创建中遇到问题..
我在 Jupyter 中的代码
%%Writefile myfile.txt
Hello this is rajat
i am a grate guy
and i like singing
解决方案
你应该用%%writefile
小写字母写,不要大写“w”。并分开行%%writefile sample.txt
和您的实际文本。
它应该是这样的:
%%writefile myfile.txt
Hello this is rajat i am a grate guy and i like singing