A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/080582.html below:

how to map python 2.0 string opeartion to python 1.5.2 ?

how to map python 2.0 string opeartion to python 1.5.2 ?ed_tsang at yahoo.com ed_tsang at yahoo.com
Tue Apr 3 20:20:06 EDT 2001
Is there a way to map the following lines to 1.5.2?
I amusing 1.5.2 not the sys admin won;t upgrade to 2.0. I got a 
scirpt written for 2.0 and try to port it back to 1.5.2 ..


Code:

                   [fromValue, toValue] = line.split(delimiter)[:2] # 
Split line
        replaced by:           
                   [fromValue, toValue] = string.split(line,delimiter)

       .......
No idea how to replace these lines with 1.5.2 syntax:  
           if caseInsensitive:
                #    charMap[ord(fromValue.upper())] = toValue
                #    charMap[ord(fromValue.lower())] = toValue
replaced by:
		I don't know ...             
                # self.charMap = "".join(charMap)
replaced by:            
   	      self.charMap = string.join("",charMap)
 ............
       if not wholeWords:
            # rePattern = '|'.join(map(re.escape, fromVals))
replaced by:  
		rePattern = string.join('|', map(re.escape,fromVals))
        else:
            # rePattern = r'\b(' + '|'.join(map(re.escape, fromVals)) 
+ r')\b'
replaced by:
            temp = string.join('|', map(re.escape,fromVals))
            temp = string.join(temp,r')\b')
            rePattern = string.join(r'\b(',temp) --- ???
Tahnks




More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4