I even converted the contents of English or special characters in the text file
I don't know how to convert numbers into Korean.
If it's a job position, I'll just put it in as below.
Since the back of the decimal place is also in the text file
I don't know how to code..
Please help me.
input = open("keyword.txt", "rt", encoding="utf8")
output = open("output.txt", "wt", encoding="utf8")
with input, output:
while True:
chunk = input.read(4096)
if not chunk:
break
chunk = chunk.replace("\u000B", "")
chunk = chunk.replace ("cm", "cm")
chunk = chunk.replace ("mm", "millimeter")
chunk = chunk.replace("m", "meter")
chunk = chunk.replace (".", "dot")
chunk = chunk.replace("?"), "question mark)
chunk = chunk.replace ("!", "exclamation mark")
chunk = chunk.replace ("+", "plus")
chunk = chunk.replace ("-", "minus")
chunk = chunk.replace ("x", "multiplied")
chunk = chunk.replace ("÷", "divide")
chunk = chunk.replace("=", "" is ")
output.write(chunk)
A function that reads numbers in Korean There's a comment like this.
Have you tried the method above?
If you use the function that reads the number in Korean, you can change the given number to Korean.
I'm sure you're curious about how to find consecutive numbers in a text file. Number representative characters and The function of finding one or more consecutive characters in the regular expression is easy to solve.
regex = r'\d+'
search_target = '''Luke Skywarker 02-123-4567 [email protected]
Darth Vader 070-9999-9999 [email protected]
princess leia 010 2454 3457 [email protected]'''
import re
result=re.findall(regex,search_target)
print(result)
If you run the code above, you will get a number one by one and enter the result.
You can put the number in the Korean reading function and change it~
© 2024 OneMinuteCode. All rights reserved.