Parse and write data from/to a xml file
I don't know anything about phyton, but I will throw my 5 ct in anyway.  

Adding horizontal spaces between assignments to variables/properties and vertical spacing between related parts will make your code more readable like so  

for row in fichier:
        name1 = row[0] #name of the first port
        name2 = row[1] 

        portid1 = str(tree.xpath("//name[text()='%s']/parent::*/id/text()" %name1)) #searches for the port id in the .xml
        portid2 = str(tree.xpath("//name[text()='%s']/parent::*/id/text()" %name2))

        portid1 = portid1[2:-2] #output was surrounded by [""] so i cut the first two and last two
        portid2 = portid2[2:-2]

        result.append(("&lt;link&gt;\n&lt;portid1&gt;{}&lt;/portid1&gt;\n&lt;portid2&gt;{}&lt;/portid2&gt;\n&lt;/link&gt;\n").format(portid1, portid2)) #store data


If you need a comment about a variable, then this variable is poorly named. So better name the variable in a meaningful name and remove the comment.  


name1=row[0] #name of the first port
name2=row[1]  



vs.  

first_port_name = row[0]
second_port_name = row[1]   


The same approach I would use for 


portid1=str(tree.xpath("//name[text()='%s']/parent::*/id/text()" %name1)) #searches for the port id in the .xml
portid2=str(tree.xpath("//name[text()='%s']/parent::*/id/text()" %name2))  



like so  

first_port_id = str(tree.xpath("//name[text()='%s']/parent::*/id/text()" %name1)) #searches for the port id in the .xml
second_port_id = str(tree.xpath("//name[text()='%s']/parent::*/id/text()" %name2))


So the mentioned points together would look like so  

for row in fichier:
        first_port_name = row[0]
        second_port_name = row[1] 

        first_port_id = str(tree.xpath("//name[text()='%s']/parent::*/id/text()" %name1)) #searches for the port id in the .xml
        second_port_id = str(tree.xpath("//name[text()='%s']/parent::*/id/text()" %name2))

        first_port_id = first_port_id[2:-2] #output was surrounded by [""] so i cut the first two and last two
        second_port_id = second_port_id[2:-2]

        result.append(("&lt;link&gt;\n&lt;portid1&gt;{}&lt;/portid1&gt;\n&lt;portid2&gt;{}&lt;/portid2&gt;\n&lt;/link&gt;\n").format(first_port_id , second_port_id )) #store data