0

I want to remove starting white spaces from the certain letters and numbers. It is a string. I tried using strip() and regex sub but it fails.

Here the text:

2019-05-23 10:51 IST
  192.168.1.1 (192.168.1.1)

  192.168.1.2 (192.168.1.2)

  192.168.1.3 (192.168.1.3)

  android-eb20919729f10e96 (192.168.1.4)

  maheshkumar-thinkpad-t410 (192.168.1.5)

  kavin-t420 (192.168.1.7)

  smackcoders (192.168.1.8)


 (7 hosts up) scanned in 22.99 seconds

I used this code but fails:

data = re.sub(r'^[a-z]*', ' ',my_data)

I want it like this:

2019-05-23 10:51 IST
192.168.1.1 (192.168.1.1)

192.168.1.2 (192.168.1.2)

192.168.1.3 (192.168.1.3)

android-eb20919729f10e96 (192.168.1.4)

maheshkumar-thinkpad-t410 (192.168.1.5)

kavin-t420 (192.168.1.7)

smackcoders (192.168.1.8)


(7 hosts up) scanned in 22.99 seconds
petezurich
  • 9,280
  • 9
  • 43
  • 57
Smack Alpha
  • 1,828
  • 1
  • 17
  • 37

0 Answers0