Org–Babelを使用して読み書きのできる Python を作成する場合、インデント レベルを制御できる必要があります (明示的:indentation-level 3
または巧妙な指示による暗黙のいずれか)。
問題を示すサンプル ファイルを次に示します。
#+BEGIN_SRC python :tangle "sample.py"
class Test:
def __init__(self):
self.a = 'a test class'
#+END_SRC
#+BEGIN_SRC python :tangle "sample.py"
def say_hi(self):
print 'Hi from this Test object!'
print 'ID: {}'.format(repr(self))
print 'Data: {}'.format(str(self.__dict__))
#+END_SRC