[Python]シングルコーテーションをエスケープするサンプル

書式
\’ シングルコーテーション
\" ダブルコーテーション
\t タブを表示
\\ バックスラッシュ
使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# coding: utf-8
# シングルコーテーション\'
print ('AA\'12345')
print ("BB'12345")
# ダブルコーテーション \""
print ("CC\"12345")
print ('DD"12345')
# タブを表示 tab
print ("EE\t12345")
# バックスラッシュ \
print ("FF\\12345")
# coding: utf-8 # シングルコーテーション\' print ('AA\'12345') print ("BB'12345") # ダブルコーテーション \"" print ("CC\"12345") print ('DD"12345') # タブを表示 tab print ("EE\t12345") # バックスラッシュ \ print ("FF\\12345")
# coding: utf-8

# シングルコーテーション\'
print ('AA\'12345') 
print ("BB'12345") 

# ダブルコーテーション \""
print ("CC\"12345") 
print ('DD"12345')

# タブを表示 tab
print ("EE\t12345") 

# バックスラッシュ \
print ("FF\\12345")

結果
AA’12345
BB’12345
CC"12345
DD"12345
EE 12345
FF\12345

Python

Posted by arkgame