I have a list of strings which has below elements. This list can have 1,2, or more elements.
list=['abc', 'xyz']
I want to use them and create a one line string like below and use it later in some other string concatenations (creating a command):
Move abc to folder c:\data, move xyz to folder c:\data
Until now I have managed to print them with:
for i in list:
print("Move '" + i + "' to folder 'C:\DATA'",end=", ")
output is:
Move 'xyz' to folder 'c:\DATA', Move 'xyz' to folder 'c:\DATA',
I want to remove the last comma and if possible to assign this output to a variable. Finally the scope is to generate and execute a command (using subprocess module) like this:
restore database db move 'xyz' to folder 'c:\data', Move 'xyz' to folder 'c:\DATA' -server servername -instance instance_name