Python has a simple concatenation using the +
operator. But I am observing something unusual.
I tried :
final_path = '/home/user/' + path + '/output'
Where path
is a staring variable I want to concatenate.
print final_path
gives me:
/home/user/path
/output
Instead of /home/user/path/output
Why is going to the next line. Is the forward slash causing the issue. I tried using the escape character as well. but It does not work.
From the looks of your code, it may be the variable path
that is the problem. Check to see if path
has a new line at the end. Escape characters start with a backslash \
and not a forward slash /
.