编写一个程序demo.py
lines_maxlenth = 0
line_numbers = 1
hh_in = open("demo.py","r").readlines()
hh_out = open("demo_new.py", "w") # 运行生成一个demo new.py文件
for i in hh_in:
if(lines_maxlenth < len(i)): #寻找最长语句行长度
lines_maxlenth = len(i)
for i in hh_in:
i = i.ljust(lines_maxlenth+1).replace('\n','') + '#' + str(line_numbers) + "\n"
line_numbers += 1 # 每行行号增加
hh_out.write(i
形成新的程序

博客主要讲述了编写一个名为demo.py的程序,并形成新的程序,涉及程序编写相关信息技术内容。
938

被折叠的 条评论
为什么被折叠?



