텍스트 변수에서 따옴표 제거하기

개발하는 G0·2023년 2월 28일
0
def dequote(s):
    """
    If a string has single or double quotes around it, remove them.
    Make sure the pair of quotes match.
    If a matching pair of quotes is not found, return the string unchanged.
    """
    if (s[0] == s[-1]) and s.startswith(("'", '"')):
        return s[1:-1]
    return s

https://sancs.tistory.com/28

profile
초보 개발자

0개의 댓글