PLplot  5.10.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
TclSup.py
Go to the documentation of this file.
1 # Tcl Support module. For coping with Tcl-esque things in Python.
2 
3 #from regsub import *
4 import re;
5 
6 def TclList2Py(s):
7  r = []
8  if s[0] == '{':
9  # List elements eclosed in braces.
10  j = 0
11  itm = ""
12  btwn_items = 1
13  for i in range(len(s)):
14  if btwn_items:
15  if s[i] == '{':
16  itm = ""
17  btwn_items = 0
18  continue
19 
20  if s[i] == '}':
21  # Finishing up an item.
22  r.append( itm )
23  btwn_items = 1
24  continue
25 
26  itm = itm + s[i]
27 
28  else:
29  # List elements delimited by spaces
30  r = re.split( s, ' ')
31 
32  return r