I currently have this list: ['/', 'home', 'documents', 'pictures']
and I have this loop:
for i, dir in enumerate(path):
if i == 0:
print(dir, end="")
elif i == len(path) - 1:
print(dir)
else:
print(dir, end='/')
which will output /home/documents/pictures.
How can I assign the output of this loop to a variable?
e.g.
print(var) will output /home/documents/pictures