• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

TclSup.py

Go to the documentation of this file.
00001 # Tcl Support module.  For coping with Tcl-esque things in Python.
00002 
00003 #from regsub import *
00004 import re;
00005 
00006 def TclList2Py(s):
00007     r = []
00008     if s[0] == '{':
00009         # List elements eclosed in braces.
00010         j = 0
00011         itm = ""
00012         btwn_items = 1
00013         for i in range(len(s)):
00014             if btwn_items:
00015                 if s[i] == '{':
00016                     itm = ""
00017                     btwn_items = 0
00018                     continue
00019 
00020             if s[i] == '}':
00021                 # Finishing up an item.
00022                 r.append( itm )
00023                 btwn_items = 1
00024                 continue
00025         
00026             itm = itm + s[i]
00027 
00028     else:
00029         # List elements delimited by spaces
00030         r = re.split( s, ' ')
00031 
00032     return r

Generated on Wed Oct 12 2011 20:42:23 for PLplot by  doxygen 1.7.1