This may not be exactly what you want, but it should give you a solid starting point. Below are two sequences (maybe save them into test.fas), of which the second is mutated randomly in 7 positions compared to first:
This short python code may be saved into file fasta_diff.py:
import sys
import numpy as np
from Bio import SeqIO
FastaFile = open(sys.argv[1], 'r')
store = np.array([])
for seqs in SeqIO.parse(FastaFile, 'fasta'):
store = np.append(store, str(seqs.seq))
for z in range(len(store[0])):
if store[0][z] != store[1][z]:
print('%s' % (store[0][z]+str(z+1)+store[1][z]))
FastaFile.close()
Running python fasta_diff.py test.fas will produce the following output:
Thank you Mensur!