Changeset 1344 for CMIP6dreqbuild/trunk/src/framework/utils_wb.py
- Timestamp:
- 19/03/20 21:16:25 (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
CMIP6dreqbuild/trunk/src/framework/utils_wb.py
r818 r1344 1 import string,itertools2 import xlrd, s tring, shelve, os, re, sys1 import itertools 2 import xlrd, shelve, os, re, sys 3 3 import collections 4 4 import xlutils, xlwt … … 13 13 def uniCleanFunc(ss,jsFilt=False): 14 14 if type(ss) in [type('x'),type(u'x')]: 15 ss = string.replace( ss, u'\u2013', '-' ) 16 ss = string.replace( ss, u'\u2010', '-' ) 17 ss = string.replace( ss, u'\u2018', "'" ) 18 ss = string.replace( ss, u'\u201c', "'" ) 19 ss = string.replace( ss, u'\u201d', "'" ) 20 ss = string.replace( ss, u'\u2019', "'" ) 21 ss = string.replace( ss, u'\u2026', '...' ) 22 ss = string.replace( ss, u'\u25e6', 'o' ) 23 ss = string.replace( ss, u'\xad', '-' ) 24 ss = string.replace( ss, u'\xb2', '2' ) 25 ss = string.replace( ss, u'\xb3', '3' ) 15 ss = ss.replace( u'\u2013', '-' ) 16 ss = ss.replace( u'\u2010', '-' ) 17 ss = ss.replace( u'\u2018', "'" ) 18 ss = ss.replace( u'\u201c', "'" ) 19 ss = ss.replace( u'\u201d', "'" ) 20 ss = ss.replace( u'\u2019', "'" ) 21 ss = ss.replace( u'\u2009', " " ) 22 ss = ss.replace( u'\u2026', '...' ) 23 ss = ss.replace( u'\u25e6', 'o' ) 24 ss = ss.replace( u'\xfc', 'u' ) 25 ss = ss.replace( u'\xad', '-' ) 26 ss = ss.replace( u'\xb1', '+-' ) 27 ss = ss.replace( u'\xb2', '2' ) 28 ss = ss.replace( u'\xb0', 'o' ) 29 ss = ss.replace( u'\xb3', '3' ) 26 30 if jsFilt: 27 ss = s tring.replace( ss,'"', "'" )28 ss = s tring.replace( ss,'\n', ";;" )31 ss = ss.replace( '"', "'" ) 32 ss = ss.replace( '\n', ";;" ) 29 33 return ss 30 34 else: … … 108 112 109 113 if oname not in self.sns: 110 print '%s not in %s' % (oname,str(self.sns) )114 print ( '%s not in %s' % (oname,str(self.sns) ) ) 111 115 raise 112 116 … … 147 151 return sheet 148 152 except: 149 print '################# failed to find sheet: %s ############' % name153 print ( '################# failed to find sheet: %s ############' % name ) 150 154 return None 151 155 … … 209 213 ee[k] = l 210 214 except: 211 print l215 print ( l ) 212 216 raise 213 217 return ee … … 217 221 for i in ov: 218 222 ll.append( '%s|%s|%s' % tuple( map( str, i) ) ) 219 return string.join(ll, '; ')223 return '; '.join(ll ) 220 224 221 225 … … 317 321 if not novar: 318 322 if mip == "SIMIP": 319 print htmlline320 htmlline = string.replace( htmlline,u'\u2013', '-' )321 htmlline = string.replace( htmlline,u'\u2018', "'" )322 htmlline = string.replace( htmlline,u'\u2019', "'" )323 htmlline = string.replace( htmlline,u'\u2026', '...' )324 htmlline = string.replace( htmlline,u'\u25e6', 'o' )325 htmlline = string.replace( htmlline,u'\xb2', '2' )326 htmlline = string.replace( htmlline,u'\xb3', '3' )323 print ( htmlline ) 324 htmlline = htmlline.replace( u'\u2013', '-' ) 325 htmlline = htmlline.replace( u'\u2018', "'" ) 326 htmlline = htmlline.replace( u'\u2019', "'" ) 327 htmlline = htmlline.replace( u'\u2026', '...' ) 328 htmlline = htmlline.replace( u'\u25e6', 'o' ) 329 htmlline = htmlline.replace( u'\xb2', '2' ) 330 htmlline = htmlline.replace( u'\xb3', '3' ) 327 331 if self.oo != None: 328 332 self.oo.write( "<tr>%s</tr>" % str(htmlline) + '\n' ) … … 336 340 s = r[1].value 337 341 if mipt[:4] in ['SPEC','CORD', 'CCMI'] and s != 'none': 338 print self.mip,mipt342 print ( [self.mip,mipt] )
Note: See TracChangeset
for help on using the changeset viewer.