Commit 333fea07 by BellCodeEditor

auto save

parent 702123ed
Showing with 33 additions and 0 deletions
f =open('test1.py','w',encoding='utf-8')
f.write('# @time:2022/1/28 15:57\n# @Author: LA\n''key_list = []\nvalue_list =[]')
f.close()
f = open('test1.py','r',encoding='utf-8')
ls = f.reaslines()
f,close()
f = open('test1.py', encoding='utf-8')
j = len(ls)
for i in range(j):
line = f.readline()
if line[0] =='#':
print(f'以#号 开头行行数:{i+1}')
else:
print(line,end='')
f.close()
f = open('test1.py',encoding='utf-8')
ls = f.reaslines()
for index,line in enumerate(ls):
if line.startswith('#'):
print(f'以#号 开头行行数:{index+1}')
else:
print(line,end='')
f.close()
# @time:2022/1/28 15:57
# @Author: LA
key_list = []
value_list =[]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment