Yunce
发表于 2020-5-4 16:28:30
[ code]新人报道,多多关照[/ code]
言16
发表于 2020-5-4 15:12:36
试试
试试就试试
九千
发表于 2020-5-3 19:22:35
report
九千
发表于 2020-5-3 19:21:58
九千
发表于 2020-5-3 19:21:23
import requests
小猪鼠
发表于 2020-5-2 22:40:06
print("I love fishc.com")
print("test code")
星河主炮
发表于 2020-5-1 13:46:57
import easygui as g
import os
import sys
#找文件模块
def serch_file():
file = 0
source_code = []
source_py = []
#source_c = [] 几个为其他语言预留的列表位
#source_cpp = []
#source_pas = []
#source_asm = []
path = g.diropenbox(msg = '打开放置代码的文件夹',title = '代码行数统计')
file_name = os.listdir(path)
for i in file_name:
if i.endswith('.py') == True:#笔者只学python,偷个懒,若要显示其他语言就多写几个,或者用嵌套函数
source_code.append(i) #构造文件名列表
source_py.append(i) #单纯对于.py文件来说此步纯属多余,对于显示多种有必要使用
file = file + 1
return (file,source_code,source_py)#此处避免区分全局变量与局部变量 return只能返回一个值,但是可以返回一个列表或元组装作只返回了一个值
#读文件模块
def calc_code(x):#calc是calculate的缩写
lines = 0
for i in x:#条件用while,遍历用for
f = open(i,encoding = 'UTF-8')#此句最好加上,不过没有也不一定就不行
for each_line in f: #统计行数
lines += 1
return lines
#显示文件模块
def show_result(a,b,e):
c = (b/100000)*100
d = 100000 - b
e1 = len(e)
g.textbox(msg = ('共编写了%d个文件,源代码共%d行,距离100,000行的目标已完成%.2f %%\n目前尚有%d行代码要编写。'%(a,b,c,d)),title = '代码行数统计',text = ('共有.py文件%d个。'%(e1)))
g.msgbox(msg='感谢使用',ok_button = '做的好!')
return
#主程序
list1 = serch_file()
a = list1
x = list1
e = list1
b = calc_code(x)
show_result(a,b,e)
sys.exit(0)
#在找文件模块中推荐使用绝对路径,否则该python程序必须与检测文件夹放在同一目录下,不然会报错。这里再偷个懒,因为这个文件也算代码,不会放在别的地方,bug不会出现
telefar
发表于 2020-4-27 13:07:04
print("I love fishc.com")
print("test code")
_2_
发表于 2020-4-27 09:44:40
范xx 发表于 2020-4-25 23:23
【temp =1】
使用英文半角符号
入坑鱼
发表于 2020-4-27 09:33:06
试一下
两行
froggy
发表于 2020-4-26 18:07:10
print(' I l"o"ve fishc.com ')
入坑鱼
发表于 2020-4-26 13:59:55
试一试
范xx
发表于 2020-4-25 23:23:13
【temp =1】
毛血旺
发表于 2020-4-23 13:57:37
printf("试一下");
晨曦之星
发表于 2020-4-23 11:47:25
试试
热心市民小李
发表于 2020-4-22 20:48:53
试试
试试就试试
ecupmimi
发表于 2020-4-21 17:15:36
print(' I l"o"ve fishc.com ')
zheliu
发表于 2020-4-19 11:03:47
ejhjdf
zheliu
发表于 2020-4-19 11:03:02
zheliu
发表于 2020-4-19 11:01:53