Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (18.4k points)

I have the list like this, how I can delete that whitespace??

['\n                                                      Slot 1 \n                                                  ', "\n Sinh hoạt 11   \n                                                                      at  B304 \n 07h30' - 08h15' \nCó mặt\n", "\n Lịch sử lớp 11   \n                                                                      at  B304 \n 07h30' - 08h15' \nCó mặt\n", "\n Kỹ năng Tư duy phản biện  11   \n                                                                      at  B304 \n 07h30' - 08h15' \nCó mặt\n", ' - ', "\n Ngữ văn lớp 11   \n                                                                      at  B304 \n 07h30' - 08h15' \nChưa điểm danh\n", ' - ', ' - ']

1 Answer

0 votes
by (36.8k points)

Use the .strip():

l = ['\n                                                      Slot 1 \n                                                  ', "\n Sinh hoạt 11   \n                                                                      at  B304 \n 07h30' - 08h15' \nCó mặt\n", "\n Lịch sử lớp 11   \n                                                                      at  B304 \n 07h30' - 08h15' \nCó mặt\n", "\n Kỹ năng Tư duy phản biện  11   \n                                                                      at  B304 \n 07h30' - 08h15' \nCó mặt\n", ' - ', "\n Ngữ văn lớp 11   \n                                                                      at  B304 \n 07h30' - 08h15' \nChưa điểm danh\n", ' - ', ' - ']

Want to be a master in Data Science? Enroll in this Data Science Courses

Browse Categories

...