I am relatively new to python. Suppose I have the following string -
tweet1= 'Check this out!! #ThrowbackTuesday I finally found this!!'
tweet2= 'Man the summer is hot... #RisingSun #SummerIsHere Can't take it..'
Now, I am trying to delete all hashtags(#) within the tweets such that -
tweet1= 'Check this out!! I finally found this!!'
tweet2= 'Man the summer is hot... Can't take it..'
My code was -
tweet1= 'Check this out!! #ThrowbackTuesday I finally found this!!'
i,j=0,0
s=tweet1
while i < len(tweet1):
if tweet1[i]=='#':
j=i
while tweet1[j] != ' ':
++j
while i<len(tweet1) and j<len(tweet1):
++j
s[i]=tweet1[j]
++i
++i
print(s)
This code gives me no output and no errors which leads me to believe that I am using the wrong logic. Is there an easier solution to this using regex?