Search code examples
python-3.xencodingpython-idle

Want to input "#" using IDLE


I'm using IDLE and for the script I'm writing I need to be able to input #. Using IDLE to execute the code, the # appears red even as input, as it does when used to wrote comments. How can this be worked around? I'm not too versed in the various encodings and such, looking to find a way to make it work with IDLE.


Solution

  • Just enter the string you want to enter. No 'workaround' is needed. It is a minor bug that IDLE applies syntax coloring to input responses, but is it harmless other than the distraction.

    >>> s = input(': ')
    : #@%!#     
    >>> s
    '#@%!#'