encode in UTF-8-BOM


Dear all,

I have some files coded as UTF-8 and I want to convert in UTF-8-BOM.

In vernalis “url decode” I don’t see the UTF-8-BOM.

I found a solution using Python with the following script:

s= open(r"C:\XXX\file.yml", mode=“r”, encoding=“utf-8”).read()
open(r"C:\XXX\file.yml", mode=“w”, encoding=“utf-8-sig”).write(s)

How I can implement this in “python script” node?
I wish put this script in loop where the URL of the files in input change with the iterarion and the file will be saved with the BOM
also what I have to put in output in this case?

I’m a noob in python so i need help