生成验证码的代码

C

#include <stdio.h>
int main(void)
{
	FILE *fptr = fopen("code.txt", "w");
        for(int i=0; i<=999999; i++) {
                fprintf(fptr, "%06d
", i); 
        }
	fclose(fptr);
        return 0;
}

Python

f = open("code.txt", "wt")
for i in range(1000000):
	f.write("{0:06}
".format(i))
f.close()

用python写程序果然比C语言写得更快一些, pyhon代码都更短一些,只是追求执行效率的还是要用C语言来写.

原文地址:https://www.cnblogs.com/freedom-try/p/15189172.html