This Question Already have a solution but In my case I'm not getting the correct solution where am I getting wrong?
import os,sys filename = "C:\Users\Dell\Desktop\ProjectShadow\app2\aapp2s.py" directory, module_name = os.path.split(filename) module_name = os.path.splitext(module_name)[0] print(module_name) print(directory) Insterd I want
>> aapp2s C:\User\Dell\Desktop What's Wrong ?

r"C:\users\....\ais a special escape sequence."C:\\Users\\Dell\\Desktop\\ProjectShadow\\app2\\aapp2s.py", or userprefix, e.g.r"C:\Users\Dell\Desktop\ProjectShadow\app2\aapp2s.py"