python中的单双引号与编码风格

作者: fanjindong | 来源:发表于2017-08-02 14:33 被阅读0次

    For example:

    LIGHT_MESSAGES = {
        'English': "There are %(number_of_lights)s lights.",
        'Pirate':  "Arr! Thar be %(number_of_lights)s lights."
    }
    
    def lights_message(language, number_of_lights):
        """Return a language-appropriate string reporting the light count."""
        return LIGHT_MESSAGES[language] % locals()
    
    def is_pirate(message):
        """Return True if the given message sounds piratical."""
        return re.search(r"(?i)(arr|avast|yohoho)!", message) is not None
    

    原文出处
    Single quotes vs. double quotes in Python
    结论
    SQL语句字符串单引号,json数据传递字符串双引号,至于Python,爱用啥用啥。

    相关文章

      网友评论

        本文标题:python中的单双引号与编码风格

        本文链接:https://www.haomeiwen.com/subject/ouoelxtx.html