You could also use an appropriate moulded power cord set. These are standard items, and should be locally available. The power cord end going to the computer would have an IEC C7 connector. The other power cord end would usually be a Type C mains Europlug (or another mains plug, depending on the country you visit).
https://en.wikipedia.org/wiki/IEC_60320
https://www.iec.ch/world-plugs
It is good practice to check the voltage and frequency before connecting anything to a wall socket in a foreign country. There should be a label or text on a computer, et cetera (a magnifying glass may help). Apple devices would typically have an input voltage range of something like 100-240 V AC at 50/60 Hz, but exceptions cannot be ruled out.