Emacs 27.050
Windows 10


I want to export python code block from my org file to the file.

When executing block there is the following result:

#+BEGIN_SRC python :session  :results output :exports code :file example.py
print ("foo"+ "bar")

Here is what is written to the file example.py
==> foobar

How can I export source code to the file?


So with the help of @Juancho I have found the answer to this question. It was solved with the help of org-babel-tangle (C-c C-v t), with such header:

#+BEGIN_SRC python :tangle example.py
print ("foo"+ "bar")
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.