SHARE
TWEET

register_line_magic

DeaD_EyE Apr 23rd, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @register_line_magic
  2. def pb(line):
  3.     idx, title = line.split(maxsplit=1)
  4.     if not title:
  5.         title = None
  6.     try:
  7.         idx = int(idx)
  8.     except ValueError:
  9.         return 'First argument is not an integer'
  10.     try:
  11.         code = In[idx]
  12.     except IndexError:
  13.         return 'CellIndex does not exist.'
  14.     return pastebin.paste_python(code, title)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top