Python escape character

Source: Internet
Author: User

Python format substitution and meaning of the string

Symbol Description
%c Formatting characters and their ASCII code
%s formatting strings
%d formatting integers
%u Formatting an unsigned integer
%o Formatting an unsigned octal number
%x formatting unsigned hexadecimal numbers
%x Format unsigned hexadecimal number (uppercase)
%f Format floating-point numbers to specify the precision after a decimal point
%e Format floating-point numbers with scientific notation
%E function with%e, format floating-point numbers with scientific notation
%g Depending on the size of the value, use%f live%e
%G function with%g, depending on the size of the value to use%f live%e
%p Format the address of a variable with hexadecimal number

Python's escape character and its meaning


Symbol Description
\‘ Single quotation marks
\" Double quotes
\a Issue System ring tones
\b Backspace
\ n Line break
\ t Horizontal tab
\v Portrait tab
\ r Carriage return character
\f Page break
\o Characters represented by octal numbers
\x The hexadecimal number represents the character
\000 Terminator, the string after \000 is all ignored


If you output "\" In a string, use "\ \"


This article from "Saab √ Martini" blog, declined reprint!

Python escape character

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.