Always remember that slashes behave differently from most other symbols in strings. Slashes in python usually are for making special characters. With that said always remember that you cannot end python string with \
slashes, what you want to do is either escape it or make it a raw string since it is a path.
For a raw string you should have something like this
path='E:\programming_section\data_science_and_ml\kist\six_sem_project\alImdb '
positiveFiles = [x for x in os.listdir(path+r"train\pos\") if x.endswith(".txt")]
negativeFiles = [x for x in os.listdir(path+r"train\neg\") if x.endswith(".txt")]
testFiles = [x for x in os.listdir(path+r"test\") if x.endswith(".txt")]
But if you decide to go with escaping the slashes then
path='E:\programming_section\data_science_and_ml\kist\six_sem_project\alImdb '
positiveFiles = [x for x in os.listdir(path + "train\pos" + "\\") if x.endswith(".txt")]
negativeFiles = [x for x in os.listdir(path + "train\neg" + "\\") if x.endswith(".txt")]
testFiles = [x for x in os.listdir(path + "test" + "\\") if x.endswith(".txt")]
You could also consider using the os.path.join
path='E:\programming_section\data_science_and_ml\kist\six_sem_project\alImdb '
positiveFiles = [x for x in os.listdir(os.path.join(path + "train\pos") if x.endswith(".txt")]
negativeFiles = [x for x in os.listdir(os.path.join(path + "train\neg")) if x.endswith(".txt")]
testFiles = [x for x in os.listdir(os.path.join(path + "test")) if x.endswith(".txt")]
Personally i would recommend the raw string option