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.
os.path.join(os.sep, 'home', 'user', path, 'output')pathfrom a file, that's your problem. Each line in the file includes the newline character. Just usepath.strip().