始めたばかりで、各行の前に数字を配置する方法がわかりません。txtファイルにあります。これは私がこれまでに持っているものです。
def numbered(infile, outfile): for line in infile: line = #ここからどこへ行けばいいかわからない
デフメイン():
try:
infileName = input("Enter the file holding the poem:")
infile = open(infileName,"r")
outfileName = input("Enter the file name to hold the numbered poem:")
outfile = open(outfileName,"w")
print("Numbered version of" + infileName + "is here in" + outfileName +)
except IOError:
print ("Error, could not find files")
主要()
最終結果は次のようになります 詩の1行目 詩の2行目 詩の3行目 ect
1. 詩の 1 行目 2. 詩の 2 行目 3. 詩の 3 行目 ect