-7

I have below string

 a = " Get a Pen"

Code:

 if a.lower().strip() == "get a pen"
     print "removed white spaces"

need help to achieve remove all spaces in the string

 if a.lower.().strip() =="getapen" # which is the easiest way remove all spaces
      print "remove all spaces in the string"
cowboy
  • 1
  • 1
  • 1

1 Answers1

0

As @ChristianDean pointed out, do

if a.lower().replace(' ', '') == 'getapen':
    print "remove all spaces in the string"
Sam Chats
  • 2,271
  • 1
  • 12
  • 34