PLplot: TclSup.py Source File

PLplot 5.15.0

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 len(s) > 0:
9 if s[0] == '{':
10 # List elements enclosed in braces.
11 j = 0
12 itm = ""
13 btwn_items = 1
14 for i in range(len(s)):
15 if btwn_items:
16 if s[i] == '{':
17 itm = ""
18 btwn_items = 0
19 continue
20
21 if s[i] == '}':
22 # Finishing up an item.
23 r.append( itm )
24 btwn_items = 1
25 continue
26
27 itm = itm + s[i]
28
29 else:
30 # List elements delimited by spaces
31 r = re.split( s, ' ')
32
33 return r
TclSup.TclList2Py
def TclList2Py(s)
Definition: TclSup.py:6