What does% mean in python?

% in python:

  1. The modulus operation is equivalent to mod, which is to calculate the remainder of the division, such as 5%2 to get 1.

  2. % Is also used in python's formatted output, such as:
         a ='test'
         print'it is a %s' %(a) The
         printed result is it is a test
    ————————————— ———
    Copyright statement: This article is the original article of the CSDN blogger "liuyhoo", which follows the CC 4.0 BY-SA copyright agreement. Please attach the original source link and this statement for reprinting.
    Original link: https://blog.csdn.net/liuyhoo/article/details/80885254

Guess you like

Origin blog.csdn.net/Love_Polaris/article/details/102841651