# Python3 데모 코드
#
# maketrans() 및 translate()
# uk 문자 번역 설정
<코드 클래스 = "일반"> str1 <코드 클래스 = "키워드"> = <코드 클래스 = "문자열"> " wy "
# 로 대체하도록 지정 str2 <코드 클래스 = "키워드"> = <코드 클래스 = "문자열"> "gf"
<코드 클래스 = " comment"> # 문자 제거
str3 = "u"
# 대상 t 문자열
trg = "weeksyourweeks"
# maketrans() for
# 빌드 번역
# 테이블 탭 파일 = trg.maketrans (str1, str2, str3)
# 원본 줄 인쇄
print ( "번역하기 전의 문자열은:" 코드> <코드 클래스 = "일반">, 끝 <코드 클래스 = "키워드"> = <코드 클래스 = "일반"> "")
인쇄 (trg)
< br> # 번역을 위해 translate()를 사용합니다.
print ( "번역 후 문자열 " , end = " ") < / p>
인쇄 (trg.translate (테이블)) 코드 > 출력: 번역 전의 문자열은 다음과 같습니다. weekyourweeks 번역 후의 문자열은 다음과 같습니다. pythonengineering layouttrans() 없이 번역 번역 사전을 지정하고 디스플레이 역할을 하는 객체로 전달하여 번역을 수행할 수도 있습니다. 이 경우 번역을 수행하기 위해 maketrans()가 필요하지 않습니다. Code # 2: layouttrans()가 없는 번역을 위한 코드입니다.
# Python3 데모 코드
# 번역 없음
# maketrans ( )
# 표시 사양
# ASCII 사용
테이블 = { <코드 클래스 = "값"> 119 <코드 클래스 = "일반">: <코드 클래스 = "값"> 103 <코드 클래스 = "일반">, <코드 클래스 = "값"> 121 <코드 클래스 = "일반">: <코드 클래스 = "값"> 102 < 코드 클래스 = "일반">, <코드 클래스 = "값"> 117 <코드 클래스 = "일반">: <코드 클래스 = "color1"> 없음 cod e> <코드 클래스 = "일반">}
<코드 클래스 = "comments"> # 대상 문자열
trg = "weeksyourweeks"
# 원본 줄 인쇄
print ( "번역하기 전의 문자열은:" , end 코드> <코드 클래스 ="키워드 "> = <코드 클래스 ="일반 ">" ")
인쇄 (trg)
# 번역 사용( ) 번역합니다.
print ( "번역 후 문자열 is:" , end = " ")
인쇄 (trg.translate(표))
출력: 번역 전의 문자열은 다음과 같습니다. weekyourweeks 번역 후의 문자열은 다음과 같습니다. pythonengineering 응용 프로그램: 대부분의 경우 코딩이나 개발 중에 오류가 발생할 수 있습니다. 이러한 기능은 오류를 교체하고 수정할 수 있는 간단하고 빠른 방법을 제공하며 잠재적으로 많은 시간을 절약할 수 있습니다.
Shop
Learn programming in R: courses $
Best Python online courses for 2022 $
Best laptop for Fortnite $
Best laptop for Excel $
Best laptop for Solidworks $
Best laptop for Roblox $
Best computer for crypto mining $
Best laptop for Sims 4 $
Latest questions
NUMPYNUMPY
psycopg2: insert multiple rows with one query
12 answers
NUMPYNUMPY
How to convert Nonetype to int or string?
12 answers
NUMPYNUMPY
How to specify multiple return types using type-hints
12 answers
NUMPYNUMPY
Javascript Error: IPython is not defined in JupyterLab
12 answers
Wiki
Python OpenCV | cv2.putText () method
numpy.arctan2 () in Python
Python | os.path.realpath () method
Python OpenCV | cv2.circle () method
Python OpenCV cv2.cvtColor () method
Python - Move item to the end of the list
time.perf_counter () function in Python
Check if one list is a subset of another in Python
Python os.path.join () method
|