Please don't be put off by my comments from exploring python or posting questions but it would have helped if you had read the Sticky messages at the top of the forum
Because you have not used code tags the layout has not been preserved so I cannot comment on your solution as a whole.
I don't mean to assasinate your code but there are a number of other problems:
You have redefined the built in list type as itself
You should avoid re-using Pythons reserved words like this. Call it mylist
It also morphs to a string and back to a list again at different places
You also redefine file
(file is the same as open in python).
loop is not needed because the read() reads all characters from a file.
Why not use
returns -1 if the test string is not found
so the test test would be
if list.find('#') != -1:
If the log file only contains what you posted then you could use:
text = myfile.read()
text = text.replace("\n#\n"," ")
text = text.replace("#","")
text = text.strip()
By the way, if you were trying to join a list together then:
is a good trick.
If the log file actaully contained multiple entries then I would suggest investigating the re
regular expressions module.