I'm new to Python and experimenting with some simple scripts. I would appreciate if you could give me some suggestions on how the following code can be improved or made simpler or anything in general.
#Coverts MAC Addresses into cisco format
def mac_conv(mac, sep='-'):
#split mac address into 3 groups
splitted_mac = mac.split(sep)
gr1 = ''.join(splitted_mac[0:2])
gr2 = ''.join(splitted_mac[2:4])
gr3 = ''.join(splitted_mac[4:])
#join groups into a single MAC
mac = gr1, gr2, gr3
final_mac = '.'.join(mac)
#print final MAC address
print(final_mac)
#Open file with MAC addresses and convert them
with open('mac.txt', 'r') as f:
for mac in f.readlines():
mac_conv(mac)