Issue
I am currently working on a Python script where I read a string and save it in name. After this step I would like to take a photo with FSWebcam and this should be saved with the variable name. I have already done the script uncomplicated, now the SD card has been defective and I start from new but I can no longer get it.
It has to be a small change, I didn't need any complicated commands or the like just the right puncture on string NAME or the command at the end from fswebcam was the solution.
import os
NAME="testname"
os.system('fswebcam -r 3840x2160 --no-banner --jpeg 100 /home/md/pictures/$NAME.jpg')
What you see here is just an example script to get the function up and running, if that works I build it into my main script.
Thank you and best regards Dominik
Solution
You should be able to use an f-string:
os.system(f'fswebcam -r 3840x2160 --no-banner --jpeg 100 /home/md/pictures/{NAME}.jpg')
Answered By - Mark Setchell Answer Checked By - Gilberto Lyons (WPSolving Admin)