1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Python string "modifiers"

Discussão em 'Python' iniciado por Stack, Março 14, 2025.

  1. Stack

    Stack Membro Participativo

    What are these "modifiers" called on the front of a Python string? I don't understand what these are used for. Also, since I don't know what they are called, I don't know what to search for to learn about them (or the others that may be available if any).

    In this example what does the "u" represent on the front of the string in the return?

    def __unicode__(self):
    return u'title: %s, text: %s, created:%s, tags: %s' % (self.title, self.text, self.created, self.tags)


    In this Django URL example, what does the "r" represent?

    urlpatterns = patterns('',
    (r'^admin/',include(admin.site.urls)),
    )


    I'm learning python and django and I see these in examples, but do not have an explanation of what they represent.

    Continue reading...

Compartilhe esta Página