Skip to content

Commit ce0ef90

Browse files
committed
added improved string printing
1 parent b8aafc2 commit ce0ef90

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

icecream/icecream.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,15 @@ def argumentToString(obj):
180180
return s
181181

182182

183+
@argumentToString.register(str)
184+
def _(obj):
185+
186+
if '\n' in obj:
187+
return "'''" + obj + "'''"
188+
189+
return "'" + obj.replace('\\', '\\\\') + "'"
190+
191+
183192
class IceCreamDebugger:
184193
_pairDelimiter = ', ' # Used by the tests in tests/.
185194
lineWrapWidth = DEFAULT_LINE_WRAP_WIDTH

0 commit comments

Comments
 (0)