How do I read from a file and write every sentenence to a different file. But every line has to be reversed and centered. Something seems to be wrong with the #write mirror file
part
#some variables
Lines = 0
ShortestLine = 80
Longestline = 0
Emptylines = 0
width = 80
Fillchar = " "
#open files
file = "radishsurvey.txt"
p = open (file,"r")
q = open ("mirroredfile.txt","w")
#loop to count lines and length
for line in p:
Lines +=1
length = len(line)
if length < ShortestLine:
ShortestLine = length
if length > Longestline:
Longestline = length
if length == 0:
Emptylines += 1
#write mirror file
q.write("{0:}\n".format(p.reversedString(line[-2::-1]).center(80)))
q.close()
p.close()
The error i get when running this code is
line 40, in <module>
q.write("{0:}\n".format(p.reversedString(line[-2::-1]).center(80)))
AttributeError: '_io.TextIOWrapper' object has no attribute 'reversedString'