Ver Fonte

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]
Dan Davison há 14 anos atrás
pai
commit
1239099120
1 ficheiros alterados com 1 adições e 4 exclusões
  1. 1 4
      lisp/ob-python.el

+ 1 - 4
lisp/ob-python.el

@@ -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