0

I have a list like this, how i can delete those 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

1 Answer 1

3

Use .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", ' - ', ' - ']
print([x.strip() for x in l]) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.