babel: python: Fix recognition of lists and tuples

2010-08-03  Dan Davison  <davison@stats.ox.ac.uk>

    * ob-python.el (org-babel-python-table-or-string): Fix
    recognition of lists and tuples

Prior to this we had

 #+begin_src python
   return [1, 2]
 #+end_src

 #+results:
 : [1, 2]
This commit is contained in:
Dan Davison 2010-08-03 00:14:35 -04:00
parent 876b115259
commit 1239099120
1 changed files with 1 additions and 4 deletions

View File

@ -125,10 +125,7 @@ Emacs-lisp table, otherwise return the results as a string."
(mapcar (lambda (el) (if (equal el 'None) 'hline el)) res)
res))
(org-babel-read
(if (or (and (equal (substring results 0 1) "[")
(equal (substring results -2 -1) "]"))
(and (equal (substring results 0 1) "(")
(equal (substring results -2 -1) ")")))
(if (and (stringp results) (string-match "^[([].+[])]$" results))
(org-babel-read
(concat "'"
(replace-regexp-in-string