I have a path but it is incomplete and i want To complete it ny adding some words | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I have a path but it is incomplete and i want To complete it ny adding some words

I have a path but it is incomplete and i want To complete it ny adding some words A='C:\user\dell' B='\desktop' C=A+B print(C) But it don't work

3rd Dec 2019, 4:15 PM
iren yeger
iren yeger - avatar
2 Answers
+ 5
If you want to use backslash it has to be done in this way. And it's not a matter of single or double quotes, both works. A="C:\\user\\dell" B="\\desktop" print(A+B) # output: C:\user\dell\desktop A='C:\\user\\dell' B='\\desktop' print(A+B) #output: C:\user\dell\desktop
3rd Dec 2019, 5:16 PM
Lothar
Lothar - avatar
+ 2
Lothar. @netclix Thank you for your help I have found another way A=r'C:\user\.....'
3rd Dec 2019, 6:04 PM
iren yeger
iren yeger - avatar