1
>>> sample7 = """including 'quote1' "quote2" and 'quote3" """
>>> sample7
'including \'quote1\' "quote2" and \'quote3" '
>>> print sample7
including 'quote1' "quote2" and 'quote3"
여기서 sample7
문자열의 따옴표는 삼중 따옴표로 올바르게 이스케이프 처리되었습니다. 그러나, sample4
에서트리플 쿼트 이스케이프 모호성
>>> sample4 = """c:\ntext\text\file.rtf"""
>>> sample4
'c:\ntext\text\x0cile.rtf'
>>> print sample4
c:
text extile.rtf
백 슬래시가 제대로 트리플 따옴표로 이스케이프되지 않았다. 왜 그런가요? 자동으로 그걸 피하기 위해해야 할 일. 예 :
String file = @"c:\ntext\text\file.rtf";
(C#)
추신. 또한 \file.rtf
대신 \x0cile.rtf
을 얻은 방법은 무엇입니까?
감사합니다. 파이썬은 \ f를 평가한다
@mirabilos를 사용합니다. 유일한 예외는 원시 문자열이 홀수 개의 슬래시로 끝날 수 없다는 것입니다. 예 : 'print r "test \\\\"'yield test \\\\ 그러나'print r "test \\\"'는 에러를 발생시킵니다. – Jim
@ 짐 오른쪽. 이것은 자동화 된 탈출을위한 정말 문제가되는 일입니다. '''접두사'', 접미사''', 내부의''모두를''\ '''로 대체하십시오. – mirabilos