url = 'https://www.qiushibaike.com/pic/page/%d/?s=5184961' for pageNum in range(1,3): new_url = format(url%pageNum)
The quoted code is from a tutorial. And I am learning by myself. The purpose of the lines is about getting all pictures in different webpages from a website via internet spider --Python.
I've known %d is a integer decimal in Line 1;
And someone has told me the usage of format is the version 2 of Python, but he couldn't tell me more about it.
Would someone please tell me the uage of 'format' in Line 3 of the code above?
1. Specifically, what are the parameters in the bracket of the format?
2. Does the first parameter- in this case 'url', stands for the string that I am going to repace?
3. There needn't to use a comma to separate url from %pageNum?
4. I've searched this usage from the Internet, but got nothing. Would you tell me what keywords are for searching it--- the usage of format in version 2, or could you provide me with the relevant links about this? I would like to learn the grammar of 'format'.
PS. English is not my native language. If my words can't be understood, please let me know.