What does the% mean？
What does the% in python mean and what role does it play?
today = target_dir + time.strftime('%Y%m%d')
now = time.strftime('%H%M%S')
In the example you give, it is coupled with a letter to form a token (called a format code, in this case) that is replaced with a value by the strftime function. For example, %Y will be replaced with the current year, including the century (2021). The documentation is here :
Python Library Reference
Search for the header containing “Format Codes” for a complete list.
When used as an operator in a numerical expression, it acts as a modulus:
Python Language Reference
Finally, it can be used as a string formatting operator:
There might be others but that’s all I can think of.
This post is deleted!last edited by