Changeset 570 in lmdz_wrf for trunk/tools
- Timestamp:
- Jul 6, 2015, 3:28:45 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r568 r570 16375 16375 return fvalues 16376 16376 16377 def reduce_last_spaces(string): 16378 """ Function to reduce the last right spaces from a string 16379 string= string to remove the spaces at the righ side of the string 16380 >>> reduce_last_spaces('Hola Lluis ') 16381 'Hola Lluis' 16382 """ 16383 fname = 'reduce_last_spaces' 16384 16385 Lstring = len(string) 16386 16387 firstspace = -1 16388 for istr in range(Lstring-1,0,-1): 16389 if string[istr:istr+1] == ' ': 16390 firstspace = istr 16391 else: 16392 break 16393 16394 if firstspace == -1: 16395 print errormsg 16396 print ' ' + fname + ": string '" + string + "' is not ended by spaces!!" 16397 print ' char. number of last character:',ord(string[Lstring:Lstring+1]) 16398 quit(-1) 16399 16400 newstr = string[0:firstspace] 16401 16402 return newstr 16403 16377 16404 #quit() 16378 16405
Note: See TracChangeset
for help on using the changeset viewer.