Advertisement
mayankjoin3

replace_spl_symbols

Nov 15th, 2024
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1. # Open the file in read mode
  2. with open('input.txt', 'r') as file:
  3.     content = file.read()
  4.  
  5. # Replace occurrences of ```python with ":"
  6. updated_content = content.replace("```python", "")
  7. updated_content = updated_content.replace("```", "")
  8. updated_content = updated_content.replace("**Option", "Option")
  9. updated_content = updated_content.replace(")**", ")")
  10. updated_content = updated_content.replace("`", "")
  11. updated_content = updated_content.replace("‘", "'")
  12. updated_content = updated_content.replace("’", "'")
  13.  
  14.  
  15. # Write the updated content back to the file
  16. with open('output.txt', 'w') as file:
  17.     file.write(updated_content)
  18.  
  19. print("Replacement done!")
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement