Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Apmaranca committed Feb 29, 2024
1 parent c8e818f commit 5d2e836
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions scripts/eliminate_tabs .py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import codecs

def replace_unicode_character(file_path, replacement=''):
"""
Replace specific Unicode character (U+200E) in the given file with the specified replacement.
Args:
- file_path: Path to the input file.
- replacement: String to replace the Unicode character with. Defaults to an empty string.
"""
# Define the Unicode character to replace
unicode_char_to_replace = '\u200E'

# Read the original content of the file
with codecs.open(file_path, 'r', encoding='utf-8') as file:
content = file.read()

# Replace the Unicode character with the desired replacement
modified_content = content.replace(unicode_char_to_replace, replacement)

# Write the modified content back to the file
with codecs.open(file_path, 'w', encoding='utf-8') as file:
file.write(modified_content)

# Example usage
file_path = '/content/Aristotle\'s Nicomachean Ethics -Limpo V15.txt' # Replace this with your actual file path
replace_unicode_character(file_path)

0 comments on commit 5d2e836

Please sign in to comment.