Changeset 1328 in lmdz_wrf for trunk/tools/generic_tools.py
- Timestamp:
- Nov 15, 2016, 4:17:01 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic_tools.py
r1326 r1328 74 74 # list_differences: Function to provide the differences between two lists 75 75 # list_norepeatcombos: Function to all possible (Num-1)-combinations of a Num values without repetitions 76 # lstring_values: Function to provide a new list-string from a string which is a list of word separated by a character if some values 77 # are repeated they are not included 76 78 # multi_index_mat: Function to provide the multiple coordinates of a given value inside a matrix 77 79 # num_chainSnum: Function to pass a value to a `ChainStrNum' number … … 10471 10473 return 10472 10474 10475 def lstring_values(liststring,sepchar,finalchar): 10476 """ Function to provide a new list-string from a string which is a list of word separated by a character if some values 10477 are repeated they are not included 10478 liststring= string of [sepchar] separated list of words 10479 sepchar= original character used to separate different words 10480 finalchar= final character used to separated values at the resultant string 10481 >>> lstring_values('tas-tas','-',':') 10482 tas 10483 >>> lstring_values('tturb-xmean-last@tturb-xmean-last','@','-') 10484 tturb-xmean-last 10485 """ 10486 fname = 'lstring_values' 10487 10488 words = liststring.split(sepchar) 10489 newwords = [] 10490 for word in words: 10491 if not searchInlist(newwords,word): newwords.append(word) 10492 10493 newstring = finalchar.join(newwords) 10494 10495 return newstring 10496 10473 10497 #quit() 10474 10498
Note: See TracChangeset
for help on using the changeset viewer.