def load(fileName): """ Loads the first file from the zip compressed file """ if isPy2x6(): zipFile = ZipFile(fileName, 'r') fileList = zipFile.namelist() if len(fileList) == 0: zipFile.close() raise IOError('No files in ' + fileName) return zipFile.open(fileList[0], 'rU') else: with ZipFile(fileName, 'r') as zipFile: fileList = zipFile.namelist() if len(fileList) == 0: raise IOError('No files in ' + fileName) return zipFile.open(fileList[0], 'r')
def testPy(self): res = utils.isPy2x6()
def removeFurigana(self, sentence): if not isPy2x6(): res = re.sub('(?<=[\u3005\u4E00-\u9FFF])《[\u3040-\u309F\u30A0-\u30FF]+》', '', sentence, 0, re.M|re.UNICODE) else: res = re.sub('(?<=[\u3005\u4E00-\u9FFF])《[\u3040-\u309F\u30A0-\u30FF]+》', '', sentence, re.M|re.UNICODE) return res