Procs
- func ascii(us: string): PyStr {....raises: [], tags: [], forbids: [].} 
- 
    
    
Example: assert ascii("ð") == r"'\U00010000'" assert ascii("Ä") == r"'\u0111'" assert ascii("å") == r"'\u548c'" let s = ascii("væ\n\e") when not defined(useNimCharEsc): let rs = r"'v\u6211\n\x1b'" else: let rs = r"'v\u6211\n\e'" assert s == rs assert ascii("\"") == "'\"'" assert ascii("\"'") == "'\"\\''" let s2 = ascii("'") when not defined(singQuotedStr): let rs2 = "\"'\"" else: let rs2 = r"'\''" assert s2 == rs2 Source Edit
- func pyrepr(s: StringLike): PyStr 
- 
    
    Shortcut for str(pyreprImpl($s)))
Example: # NOTE: string literal's `repr` is `system.repr`, as following. assert repr("\"") == "\"\\\"\"" # string literal of "\"" # use pyrepr for any StringLike and returns a PyStr assert pyrepr("\"") == "'\"'" Source Edit
- func repr(x: PyStr): string {....raises: [], tags: [], forbids: [].} 
- 
    
    Overwites system.repr for PyStr The same as proc ascii except for unicode chars being remained AS-IS, and returns Nim's string. Source Edit