当前位置: 首页>>代码示例>>Python>>正文


Python trans.translate函数代码示例

本文整理汇总了Python中trans.translate函数的典型用法代码示例。如果您正苦于以下问题:Python translate函数的具体用法?Python translate怎么用?Python translate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了translate函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do_text

 def do_text(text, translit=False):
     text = unescape(text)
     if markdown_mode:
         text = markdown(text)
     if translit:
         return (translate(text, trans_from, args.trans_to), translate(text, trans_from, "devanagari"))
     elif qtags.intersection([".html", ".md"]):
         return str(process_html(text, args.media))
     else:
         return html_escape(text)
开发者ID:abhyaasa,项目名称:.atom,代码行数:10,代码来源:2016-01-12_1-06-59+PM_cdeck.py

示例2: do_text

 def do_text(text, translit=False):
     text = unescape(text)
     if markdown_mode:
         text = str(post_markdown(markdown(text)))
     if translit:
         return (translate(text, trans_from, args.trans_to),
                 translate(text, trans_from, 'devanagari'))
     elif qtags.intersection(['.html', '.md']):
         return text
     else:
         return html_escape(text)
开发者ID:abhyaasa,项目名称:.atom,代码行数:11,代码来源:2015-12-10_8-56-44+PM_cdeck.py

示例3: translate

def translate(root,filename,lang):
    print 'Translating', filename
    dest_root = root.replace('/ru/','/'+lang+'/')
    if not os.path.exists(dest_root):
        os.makedirs(dest_root)

    input =  os.path.join(root,filename)
    output = os.path.join(dest_root,filename)

    if not os.path.isfile(output):
        trans.translate(lang,input,output)
开发者ID:nicalvarez,项目名称:e-maxx.es,代码行数:11,代码来源:walk.py

示例4: do_text

 def do_text(text, translit=False):
     print text, tags ##
     text = unescape(text)
     if markdown_mode:
         text = str(markdown(text))
     if translit:
         return (translate(text, trans_from, args.trans_to),
                 translate(text, trans_from, 'devanagari'))
     elif tags.intersection(['.html', '.md']):
         print qtags, "html or md" ##
         return text
     else:
         return html_escape(text)
开发者ID:abhyaasa,项目名称:.atom,代码行数:13,代码来源:2015-12-10_8-03-24+AM_cdeck.py

示例5: parse_item

    def parse_item(self, response, url):
        """
        parse the response of a `python requests.get()`

        @param response - an object of `requests.get()`
        @param url - current url object that has been crawled
        @return item
        """
        soup = bs4.BeautifulSoup(response.text, 'html.parser')

        # print("title: %s" % soup.title)

        it = Item()
        for link in soup.find_all('meta'):
            if link.get('name') == 'description':
                it.name_jp = link.get('content')
                it.name_zh = trans.translate(it.name_jp)
                it.link = response.url

        # print("item name_zh: %s" % it.name_zh)
        self.feed_new_urls(soup, url)
        return it
开发者ID:ArthurChiao,项目名称:crawler,代码行数:22,代码来源:crawler.py

示例6: post

 def post(self):
     self.response.headers['Content-Type'] = 'text/plain'
     python_string = self.request.get('python_string')
     self.response.write(trans.translate(python_string))
开发者ID:py2js,项目名称:py2js,代码行数:4,代码来源:py2js_app.py

示例7: do_trans

 def do_trans(text):
     return [translate(text, trans_from, args.trans_to),
             translate(text, trans_from, 'devanagari')]
开发者ID:abhyaasa,项目名称:app,代码行数:3,代码来源:cdeck.py


注:本文中的trans.translate函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。