Editing strings with python to display in GE

Hi

I had the idea of a txt file reader to display files in a more user freindly
way(ie like a regular book). So far I can open txt files and display them line by line in the GE. But I cant seem to remove the
“special Characters” which are at the end of each string. The "
" return and new line info Here is the code so far

cont=GameLogic.getCurrentController()
own=cont.getOwner()

page=own.page
f = open(“files/74.txt”, “rb”)
a = f.readlines()

#l=len(a)
b=repr(a[page])
c=b.rstrip("
")

own.Text=c
f.close()

I’ve searched this forum and python and google and can’t quite find the solution.If anyone knows what I’m missing I would love to hear from them
as I am ready to finish it up but this little problem is frustrating the daylights out of me. I will post in python forum as well.

Thanks

Dr S

"test
".rstrip() returns “test”

repr("test
").rstrip() returns “'test\r
'”

So change your line:
b=repr(a[page])

into:
b=a[page]

repr() turns anything into a printable string representation. However, the lines in your text file already are strings, so there is no need to do this.

Yes Thanks laurens

I knew I was close.I’m on the right track now

Ta

Dr S