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
#1
New to the forum so hope I'm using the correct method here: -
I'm using an app to covert h264 video to mp4 = MP4Box.
Most of the tutorials deal with conversion inside the current folder so that the command is: -

command = "MP4Box -add example.h264 example.mp4" 
This works great
Now I've found out through my own experimentation you can do something like this

command = "MP4Box -add ''/var/www/html/LifeSaverHTML/eg,h264' '/var/www/html/LifeSaverHTML/eg.mp4'"
But what I really want to do is use a variable for the path. This is my function below:-
first = path
    last = "/examplevid.mp4"    
    fullpath = first + last
    tester = "/var/www/html/LifeSaverHTML/Details/19/examplevid.h264"
    command = "MP4Box -add '"%tester"'%tester '/var/www/html/LifeSaverHTML/Details/19/examplevid.mp4'"
I've tried all sorts of suggested methods with this: -
"tester"
"'+tester+'"
I can't even remember some of the suggestions I've tried.
Can someone please tell me the correct syntax? I've been at this for 2 hours now :(
Reply


Messages In This Thread
Correct syntax for a variable inside a quotes: MP4Box command - by JonnyDriller - Feb-01-2020, 08:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Variable definitions inside loop / could be better? gugarciap 2 481 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,908 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,136 Jan-10-2023, 11:26 AM
Last Post: codinglearner
  How to write a part of powershell command as a variable? ilknurg 2 1,155 Jul-26-2022, 11:31 AM
Last Post: ilknurg
  Os command output in variable shows wrong value paulo79 2 1,552 Apr-09-2022, 03:48 PM
Last Post: ndc85430
  Cursor Variable inside Another Cursor . CX_ORacle paulo79 1 1,552 Apr-09-2022, 10:24 AM
Last Post: ibreeden
  How to use a variable in linux command in python code? ilknurg 2 1,636 Mar-14-2022, 07:21 AM
Last Post: ndc85430
  Why does absence of print command outputs quotes in function? Mark17 2 1,423 Jan-04-2022, 07:08 PM
Last Post: ndc85430
  Command output to Variable ironclaw 1 1,816 Aug-26-2021, 06:55 PM
Last Post: bowlofred
  Two types of single quotes Led_Zeppelin 2 1,952 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