title: How can I export a block of codes from Jupyter Notebook to text file?
body: <p>I have a deep learning structure that I want to export a text file so it will ease everything for me. </p>
  
  <p>This is a jupyter notebook code block: </p>
  
  <pre><code>In [7]:
  def fDNN(in_dim, out_dim):
      # Model
      model = Sequential()
      model.add(Dense(210, input_dim=in_dim, activation='relu'))
      model.add(Dense(70, activation='relu'))
      model.add(Dense(out_dim, activation='softmax'))
  
      # Compilation
      model.compile(loss='categorical_crossentropy', optimizer='adam', 
             metrics=['accuracy'])
      return model
  </code></pre>
  
  <p>Output of this block should be written in a text file same as above:</p>
  
  <pre><code>        # Model
          model = Sequential()
          model.add(Dense(210, input_dim=in_dim, activation='relu'))
          model.add(Dense(70, activation='relu'))
          model.add(Dense(out_dim, activation='softmax'))
  
          # Compilation
          model.compile(loss='categorical_crossentropy', optimizer='adam', 
                 metrics=['accuracy'])
  </code></pre>