freedom-try

C

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

Python

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

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

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2021-05-11
猜你喜欢
  • 2021-08-25
  • 2022-01-06
  • 2021-08-04
  • 2022-12-23
  • 2021-04-26
  • 2021-12-08
相关资源
相似解决方案