fork download
  1. import re
  2. phrases = [ "S/O अशोक कुमार, ब्लॉक न.-4डी, S/O Ashok Kumar, Block no.-4D.", "स्ट्रीट-15, विभाग 5. सिविक सेंटर Street-15, sector -5, Civic Centre", "भिलाई, दुर्ग, भिलाई, छत्तीसगढ़, Bhilai, Durg. Bhilai, Chhattisgarh,", ]
  3. rx = re.compile(r'[^\W\d_A-Za-z].*[^\W\d_A-Za-z]\W*')
  4. l = [rx.sub('', text) for text in phrases]
  5. print(l)
Success #stdin #stdout 0.03s 9372KB
stdin
Standard input is empty
stdout
['S/O S/O Ashok Kumar, Block no.-4D.', 'Street-15, sector -5, Civic Centre', 'Bhilai, Durg. Bhilai, Chhattisgarh,']