Exemple #1
0
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')
Exemple #2
0
 def testPy(self):
     res = utils.isPy2x6()
Exemple #3
0
 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