국어 따옴표 검사 코드
게시글 주소: https://orbi.kr/00070413261
# 파일 경로
file_path = r"D:\01. 파일\6회.txt"
# 따옴표 쌍이 맞는지 검사
def check_quotes_balance(line):
single_open_quotes = line.count('‘')
single_close_quotes = line.count('’')
double_open_quotes = line.count('“')
double_close_quotes = line.count('”')
# 따옴표 쌍이 맞지 않으면 True 반환
if (single_open_quotes != single_close_quotes) or (double_open_quotes != double_close_quotes):
return True
return False
# 파일 읽기 및 조건에 맞는 줄 출력
with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
for i, line in enumerate(lines, start=1):
if check_quotes_balance(line):
print(f"Line {i}: {line.strip()}")
따옴표 홀수개인거 찾아서 반환하는 코드
0 XDK (+0)
유익한 글을 읽었다면 작성자에게 XDK를 선물하세요.
-
4시도 안됨 2시 조발 가능세계는 없는가...
-
아빠는 운전이 힘들다고 엄마는 음식준비가 힘들다고 싸워서 서로 바꿔서 해보자고...
-
우울 4
당당해지기로 약속해놓고도 한없이 작아지는 나.. 마치 죄인이 된것만 같고 눈치를...
어디다 쓰이나요??
모고 등 문제지에 따옴표 빠진거 없나 검사합니다
에타에서 불러가지고 말 전하려 했더니 그냥 쩌는군요
2명 분의 찬양을 전합니다
카이스트 에타에 올라왔나요?
잘 쓰세요 ㅋㅋ