Nov-13-2016, 07:39 PM
How to use wierd dictionary keys like "0-._.-._.-._.-._.-._.-._.-0" (This is not one of mine)
do all the special charatcers have to be escaped?
do all the special charatcers have to be escaped?
Using dictionary keys with embedded '.'
|
Nov-13-2016, 07:39 PM
How to use wierd dictionary keys like "0-._.-._.-._.-._.-._.-._.-0" (This is not one of mine)
do all the special charatcers have to be escaped?
Nov-13-2016, 07:52 PM
No, a dictionary key can be any string... You don't need to escape anything, beyond what is needed for string literals, if your key names are in your source code.
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Nov-13-2016, 10:26 PM
Thanks
Nov-15-2016, 10:43 PM
Yes, special characters would need to be escaped. But none of those are special characters :p
>>> items = {"\n": "i'm a value!", "can't \"quote\" me!": "...oh"} >>> items {'\n': "i'm a value!", 'can\'t "quote" me!': '...oh'}...I guess our syntax highlighter can't quite handle nested strings. |
|