-1

Given this string, ###hi##python##python###, how can I remove all instances of '#'?

v = "###hi#python#python###"
x = v.strip("#")
print(x)

Expected output: "hipythonpython"

gmds
  • 16,465
  • 4
  • 22
  • 45

2 Answers2

0

What you want is not strip, but replace:

v = '###hi#python#python###'
x = v.replace('#', '') 

print(x)

Output:

hipythonpython
gmds
  • 16,465
  • 4
  • 22
  • 45
0

Just use replace

the_str = '###hi##python##python###'
clean_str = the_str.replace('#','')
print(clean_str)

Output

hipythonpython
balderman
  • 12,419
  • 3
  • 21
  • 36