title: Is there a way to remove part of a file name (path) in python?
body: <p>I have around 50 files that have their name and then the date they were created at 3 times. How can I remove that part from the file name in python (You can show an example with other data it doesn't really matter)</p>
  
  <p>I tried something like that:</p>
  
  <pre><code>file = 'directory/imagehellohellohello.png'
  keyword = 'hello'
  
  if (file.count(keyword) &gt;= 3):
      //functionality (here I want to remove the hello's from the file path)
  </code></pre>