-12

I want to remove whitespaces between two words or more and two characters and more if exist.

Example :

text = " hello w    orld "
or
text = " h el lo       w    or  ld "

And I want to be like this :

text = "hello world"

NOT "helloworld" !!

is that possible ?

Mr. zero
  • 245
  • 4
  • 18
  • 1
    Not actually, this is more on natural language parser.. – Marko Mackic Jul 23 '16 at 13:39
  • this is possible but the answer would be **too-broad** because it is not a simple problem that can be answered without a lot of code and explanation of natural language processing theory and algorithms. –  Jul 23 '16 at 13:39
  • 1
    How would Python know if `al bi ca` is `albi ca` or `al bica` or `albica` or simply `al bi ca`? – Xiobiq Jul 23 '16 at 13:40
  • 1
    requests for recommendations is **off-topic** as well –  Jul 23 '16 at 14:21

1 Answers1

1

Nope it is not possible, because python can't assume what a word is, except you use natural language parsing algorithm,I personally don't think you'd want to dig that deep, but if you do then it's a cool area to explore :)

Marko Mackic
  • 2,293
  • 1
  • 10
  • 19