Hi all,
A question for you. I have these types of files at my work (.sj extension) that I need to work with and I'm wondering if there is a way to read from the file like a text file (the .sj files can be opened / read by notepad). The .sj files basically have a bunch of code in them which I'm extracting the comments from.
My program can currently open a .txt file and extract the comment blocks but when I change the file extension it doesn't read in the text. Any ideas? Thanks.
def readComments (textfile):
comments = []
inComment = False
for i, line in enumerate(open(textfile.name)):
if "//***" in line:
inComment = not inComment
elif inComment:
line = line.lstrip("//")
comments.append((i, line))
textfile.close()
return comments