I am quite new to python and I am currently playing around with pyserial and what I am basically doing is sending simple commands via UART. A simple command that I have is:
b'page 0\xff\xff\xff'
which basically says to the hardware "Go on page with index of 0" (It is a Nextion display). What I want to do is to somehow parameterize this byte array be able to dynamically pass the 0. I've read different topics on the internet of first making it a string and later one use bytearray but I was wondering if it is not possible to apply it here somehow using string interpolation or something.
NOTE: The \xff's at the end are hardware specific and must be there.