No puedo poner la \ en python

ya intente cambiar el idioma 3 veces y solo cambian de posicion las teclas.
si puedo usar la "" en otras apps pero en python se remplaza por una especie de W

Translated: I already tried to change the language 3 times and only the keys change position. yes I can use the "" in other apps but in python it is replaced by a kind of W. (Those are 2 double quotes ".)

I presume ‘idioma’ means Windows keyboard language layout, but I am dubious about the claim. The strikethrough is created by Unicode “combining long stroke overlay” (U+0336) characters which result “in an unbroken stroke across the text”. (Strikethrough - Wikipedia)

>>> print("|W\u0336W\u0336W\u0336|")
|W̶W̶W̶|

In IDLE, the strikethrough looks exactly as intended, like in the image above. In my browser, each is shortened and shifted.

Python should not be involved. When typing in IDLE, key events are handled and displayed by a tcl/tk (unicode) Text widget. In any case, I have experienced other key misbehaviors. Rebooting Windows has worked for me.

I think that’s not a W with a strikethrough, but rather a Won sign (), and the "" is meant to say "\". So it’s a \ turning into a .

The \ character is indeed represented as a in Korean fonts, but I don’t know why it would be using a Korean font here. It may well be just a glitch that a reboot would fix.

1 Like

Thank you, this makes more sense. I checked ₩₩ in IDLE (tk Text) and it looks very similar to W, with a single bar instead of the double bar I see here, but narrower. If Isra had pasted the “>>>” line between triple backtick ``` lines, I would have copied and pasted the character into an ord() call. I should have mentioned that as the check I wanted to run.

To add a bit of information here:

Historically, it was considered that Korean character encodings actually interpreted the byte 0x5c as a Won sign rather than a backslash (similarly for the Yen sign for Japanese character encodings). However, it seems that nowadays this is emulated using fonts. For example:

>>> b'\\'.decode('euc-jp') # japanese
'\\'
>>> b'\\'.decode('euc-kr') # korean
'\\'

I got the same results with several other historically popular encodings. Meanwhile I can make the backslashes show up as a Yen symbol by changing my terminal font.

In some sense it may have always just been a font distinction - historically people were not very pedantic about this kind of thing, and historically it was necessary to change fonts in order to display non-Latin characters anyway (this is way before anyone thought of emoji as proper characters, rather than images presented in-line with text). However, informational charts describing old encodings will commonly assert that a 0x5c byte actually represents the currency symbols, rather than a backslash that happens to have a weird glyph associated with it.