[Tutor] Convert man file into readable text file
Mico Siahaan
mico@cbn.net.id
Fri, 14 Jun 2002 07:17:28 +0700
I'm a newbie. I want to make a python script to convert a man file into a
readable text file so I can edit it with a text editors.
So far, I made this:
import string
fin = open("wget.man","r")
fout = open("wget.test","w")
while 1:
line = fin.readline()
if line == "":
break
for ch in line:
if ch not in string.printable:
idx = line.find(ch)
temp = line[:idx] + line[idx+1:]
newline = temp
else:
newline = line
fout.write(newline)
fin.close()
fout.close()
And it gives a wrong result. I understand it is because I don't understand
the structure of man files.
Can anyone give me a correct example, please? Thanks.
Mico Siahaan
---
E-mail : mico at cbn dot net dot id