用户讨论:Air7538/沙盒

源代码

import pywikibot
import time
site = pywikibot.Site('zh','wikipedia')
gen = site.newpages( namespaces = 0,patrolled= False)
pagetext = ""
userlist = []
sum = 0
for page in gen:
    sum+=1
    if page[4] in userlist:
        userlist[userlist.index(page[4])+1] = userlist[userlist.index(page[4])+1] + 1
        continue
    userlist.append(page[4])
    userlist.append(1)
# print(userlist)
for i in range(2,100):
    if i in userlist:
        pagetext = pagetext + str(i) + "条 "
        pagetext = pagetext + userlist[userlist.index(i)-1] + "\n\n"
page = pywikibot.Page(site,"User:Air7538/沙盒")
localtime = time.asctime( time.localtime(time.time()) )
page.text = "此时共有" + str(sum) + "条条目未巡查,当前创建未巡查条目最多的用户:\n\n" + pagetext + "统计于:" + localtime
print(page.text)
# page.save("未巡查的新条目创建排行榜")
  • 如有取用请给本人留言看一下
返回“Air7538/沙盒”的用户页。