If you want to keep the full loadtxt power, you can simply change it to suit your needs. As David Marek noted, the line where comments are removed is this
line = asbytes(line).split(comments)[0].strip(asbytes('\r\n'))
becomes:
for com in comments: line = asbytes(line).split(com)[0] line = line.strip(asbytes('\r\n'))
You will also need to change L717:
comments = asbytes(comments)
turns into:
comments = [asbytes(com) for com in comments]
If you want to keep full compatibility,
if isinstance(comments, basestring): comments = [comments]
source share