Changeset 982 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Aug 9, 2016, 11:17:15 AM (8 years ago)
Author:
lfita
Message:

Adding 'None' option in `str_list'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/generic_tools.py

    r980 r982  
    79137913def str_list(string, cdiv):
    79147914    """ Function to obtain a list from a string givin a split character
    7915       string= Strring from which to obtain a list
     7915      string= Strring from which to obtain a list ('None' for None)
    79167916      cdiv= character to use to split the string
    79177917    >>> str_list('1:@#:$:56', ':')
     
    79257925        listv = string.split(cdiv)
    79267926    else:
    7927         listv = [string]
     7927        if srting == 'None':
     7928            listv = None
     7929        else:
     7930            listv = [string]
    79287931
    79297932    return listv
Note: See TracChangeset for help on using the changeset viewer.