For example G
is surrounded with keys R
,T
,Y
,F
,H
,V
,B
. However, this is true for my keboard.
Is it possible to get this kinda "layout" dynamically?
For example G
is surrounded with keys R
,T
,Y
,F
,H
,V
,B
. However, this is true for my keboard.
Is it possible to get this kinda "layout" dynamically?
def get_keys_around(key):
lines = 'azertyuiop', 'qsdfghjklm', 'wxcvbn'
line_index, index = [(i, l.find(key)) for i, l in enumerate(lines) if key in l][0]
lines = lines[line_index-1: line_index+2] if line_index else lines[0: 2]
return [
line[index + i] for line in lines for i in [-1, 0, 1]
if len(line) > index + i and line[index + i] != key and index + i >= 0]
Is it possible to get this kinda "layout" dynamically?
Sorry my responds is not dynamic :) but very simple (notice, I'm working with an azerty keybord, change letters list for qwert)
good luck