ใช้ regex จับคู่ whitespace เฉพาะ space/tab แต่ไม่รวม newlines ในสตริงที่กำหนด
ตัวอย่าง
import re
print(re.findall(r"(\s){1,}", """I find Tutorialspoint useful"""))
ผลลัพธ์
[' ', ' ', ' ']
ใช้ regex จับคู่ whitespace เฉพาะ space/tab แต่ไม่รวม newlines ในสตริงที่กำหนด
import re
print(re.findall(r"(\s){1,}", """I find Tutorialspoint useful"""))
[' ', ' ', ' ']