import time
def gushi():
try:
f = open(", "w", encoding="utf8")
f.write("自古逢秋悲寂寥,n我言秋日胜春朝,n一行白山路上青天,n便引诗情到碧霄")
f.close()
except Exception as result:
print("写入古诗有问题",result)
def copy():
try:
m=open("copyy","w",encoding="utf8")
f = open(", "r", encoding="utf8")
while True:
contentadline()
m.write(content)
if len(content)==0:
break
print("复制完毕")
time.sleep(2)
m.close()
m = open("copyy", "r", encoding="utf8")
countadlines()
print(count)
f.close()
except Exception as result:
print("复制入古诗有问题", result)
gushi()
copy()
#仁者见仁,智者见智,我的这个虽然也可以实现,但是觉得try语句等诸多方面的应用比较羞涩,多多指导。
本文发布于:2024-01-31 13:26:14,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170667877428854.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |