Changeset 1004 in lmdz_wrf
- Timestamp:
- Aug 11, 2016, 12:12:00 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic_tools.py
r1003 r1004 52 52 # radius_angle: Function to generate a matrix with the angle at a given point 53 53 # radius_dist: Function to generate a matrix with the distance at a given point 54 # search_sec_list: Function to provide the values and indices on a list which matches a section of a string 54 55 # significant_decomposition: Function to decompose a given number by its signifcant potencies 55 56 # singleline_printing_class: Function to print all the values of a given class in a single line to be parseavel … … 8285 8286 sys.stdout = self._stdout 8286 8287 8288 def search_sec_list(listv,sec): 8289 """ Function to provide the values and indices on a list which matches a section of a string 8290 listv= list to find matches 8291 sec= section to search for 8292 >>> romlist = ['i', 'ii', 'iii', 'iv', 'v', 'vi', 'vii', 'viii', 'ix', 'x', 'xi'] 8293 >>> search_sec_list(romlist,'ii') 8294 (['ii', 'iii', 'vii', 'viii'], [1, 2, 6, 7]) 8295 """ 8296 fname = 'search_sec_list' 8297 8298 matches = [] 8299 locs = [] 8300 il = 0 8301 for string in listv: 8302 if string.find(sec) != -1: 8303 matches.append(string) 8304 locs.append(il) 8305 il = il + 1 8306 8307 return matches, locs 8308 8287 8309 #quit() 8288 8310
Note: See TracChangeset
for help on using the changeset viewer.