Python Forum
Correct syntax for a variable inside a quotes: MP4Box command
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Correct syntax for a variable inside a quotes: MP4Box command
#2
Use string formatting and now should use f-string.
Example using your working command and put in variables.
>>> first = '/var/www/html/LifeSaverHTML/eg,h264'
>>> last = '/var/www/html/LifeSaverHTML/eg.mp4'
>>> command = f"MP4Box -add '{first}' '{last}'"
>>> print(command)
MP4Box -add '/var/www/html/LifeSaverHTML/eg,h264' '/var/www/html/LifeSaverHTML/eg.mp4'
>>> 
>>> #Assign to a variable the command is like this
>>> print(repr(command))
"MP4Box -add '/var/www/html/LifeSaverHTML/eg,h264' '/var/www/html/LifeSaverHTML/eg.mp4'"
Reply


Messages In This Thread
RE: Correct syntax for a variable inside a quotes: MP4Box command - by snippsat - Feb-01-2020, 09:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Variable definitions inside loop / could be better? gugarciap 2 513 Jan-09-2024, 11:11 PM
Last Post: deanhystad
  How to create a variable only for use inside the scope of a while loop? Radical 10 1,968 Nov-07-2023, 09:49 AM
Last Post: buran
  Need help on how to include single quotes on data of variable string hani_hms 5 2,183 Jan-10-2023, 11:26 AM
Last Post: codinglearner
  How to write a part of powershell command as a variable? ilknurg 2 1,169 Jul-26-2022, 11:31 AM
Last Post: ilknurg
  Os command output in variable shows wrong value paulo79 2 1,570 Apr-09-2022, 03:48 PM
Last Post: ndc85430
  Cursor Variable inside Another Cursor . CX_ORacle paulo79 1 1,569 Apr-09-2022, 10:24 AM
Last Post: ibreeden
  How to use a variable in linux command in python code? ilknurg 2 1,648 Mar-14-2022, 07:21 AM
Last Post: ndc85430
  Why does absence of print command outputs quotes in function? Mark17 2 1,438 Jan-04-2022, 07:08 PM
Last Post: ndc85430
  Command output to Variable ironclaw 1 1,827 Aug-26-2021, 06:55 PM
Last Post: bowlofred
  Two types of single quotes Led_Zeppelin 2 1,969 Mar-15-2021, 07:55 PM
Last Post: BashBedlam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020