The meaning of R in the Django URL

Source: Internet
Author: User
For example:

Urlpatterns = Patterns ("', # ... (R ' ^time/plus/\d+/$ ', Hours_ahead), # ...)

The beginning letter "R" of the regular expression string. It tells Python that this is an original string and does not need to handle the backslash (escape character) inside. In a normal Python string, backslashes are used to escape special characters. For example, N escapes into a newline character. When you use R to mark it as an original string, Python no longer sees the backslash as an escape character. In other words, "n" is a two string: "" and "N". Because backslashes have conflicts in Python code and regular expressions, it is recommended that you use the original string when you define a regular expression in Python.  

The meaning of R in the Django URL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.