Nodebook
  • Introduction
  • Methods
  • Default Classes
    • Nodebook
  • JS
    • JSONotebook
    • JSNotebook
    • TSNotebook
  • Java
    • JavaNotebook
  • C/C++
    • CPPNotebook
    • CNotebook
    • HeaderNotebook
  • Text
    • TXTNotebook
    • MDNotebook
    • PlainNotebook
  • Web
    • HTMLNotebook
    • CSSNotebook
      • CSSStyle
  • Other
    • YMLNotebook
    • BashNotebook
  • Python
    • PYNotebook
Powered by GitBook
On this page
  • Usage
  • Setup

Was this helpful?

  1. Python

PYNotebook

extends Nodebook

"PYNotebook" is used for .pyfiles.

Usage

Setup

const Nodebook = require('nodejs-notebook');

let main = new Nodebook.PYNotebook('main');

note(code)

Similar to addLine() but it does not automatically add an indent.

string code: The Python code to add.

main.note('print("hello world"');
// Inserts this long line of code that should output "hello world"

comment(comment)

Insert a Python Comment.

string comment: The comment message to add.

main.comment('This needs editing, Franchis!');
// Inserts '""" Look over here, Patricia! """'

run()

Attempts to run the python file.

main.run();
// Will output if there were any errors in the console.

import(module)

Inserts import () at the top with the module provided.

main.import("json");
// Inserts "import json"
PreviousBashNotebook

Last updated 3 years ago

Was this helpful?