ใช้ regex ลบ tabs และ newlines จากสตริงที่กำหนด
ตัวอย่าง
import re
print(re.sub(r"\s+", " ", """I find Tutorialspoint helpful"""))
ผลลัพธ์
I find Tutorialspoint helpful
ใช้ regex ลบ tabs และ newlines จากสตริงที่กำหนด
import re
print(re.sub(r"\s+", " ", """I find Tutorialspoint helpful"""))
I find Tutorialspoint helpful