Answers for "blank space python"

0

python is space

# isspace() is method of the <str> returns True if the string has only empty spaces
print(" ".isspace())  # True
print("     ".isspace()) # True
print(" test".isspace())  # False
print("".isspace()) # False
Posted by: Guest on March-18-2021
0

string without space pythonm

import re

string = '  Hello  World   From Pankaj tnrtHi There  '

print('Remove all spaces using RegEx:n', re.sub(r"s+", "", string), sep='')  # s matches all white spaces
print()

print('Remove leading spaces using RegEx:n', re.sub(r"^s+", "", string), sep='')  # ^ matches start
print()

print('Remove trailing spaces using RegEx:n', re.sub(r"s+$", "", string), sep='')  # $ matches end
print()

print('Remove leading and trailing spaces using RegEx:n', re.sub(r"^s+|s+$", "", string), sep='')  # | for OR condition
Posted by: Guest on August-24-2021
-1

remove space in print python

age = 20
print("My age is ", age, '.', sep='')
Posted by: Guest on June-17-2021

Python Answers by Framework

Browse Popular Code Answers by Language