回答編集履歴
1
情報の追記
answer
CHANGED
@@ -4,4 +4,15 @@
|
|
4
4
|
sss = " what's "
|
5
5
|
a = sss.replace("\'", "\\'")
|
6
6
|
print(a)
|
7
|
-
```
|
7
|
+
```
|
8
|
+
|
9
|
+
文字列を`”`で囲っている場合、`'`はそのまま書けるので、以下でもいけますね。
|
10
|
+
|
11
|
+
```Python
|
12
|
+
sss = " what's "
|
13
|
+
a = sss.replace("'", "\'")
|
14
|
+
print(a)
|
15
|
+
```
|
16
|
+
|
17
|
+
参考:
|
18
|
+
[エスケープシーケンスを使用する](https://www.javadrive.jp/python/string/index2.html)
|