返回列表 發帖
  1. n=int(input())
  2. out=""
  3. with open(r'read (3).txt','r') as r:
  4.     for j in range(n):
  5.         str1=r.readline()
  6.         str1=str1.replace("\n"," ")
  7.         for i in range(len(str1)):
  8.             if i==0:
  9.                 print(str1[i].upper(),end="")
  10.                 out+=str1[i].upper()
  11.             elif str1[i-1]==" ":
  12.                 print(str1[i].upper(),end="")
  13.                 out+=str1[i].upper()
  14.             else:
  15.                 print(str1[i],end="")
  16.                 out+=str1[i]
  17.         print()
  18.         out+="\n"
  19. with open(r"write.txt","w") as w:
  20.     w.write(out)
複製代碼

TOP

返回列表