Answer the question
In order to leave comments, you need to log in
How to change the keyboard language used on Android-e?
I bought a mini keyboard for a tablet, now I’m sitting thinking how to make it so that some key or a combination of pressing is programmed to change the language (the tablet has a Hacker keyboard, I didn’t find anything like that in the settings)
Advise a way how to achieve this
Answer the question
In order to leave comments, you need to log in
get_img returns a list and you are trying to use it as a dictionary
you should learn python, I have never seen such code at all.
import json
from pprint import pprint
from collections import defaultdict
import requests
BASE_URL = 'http://rt44.ru/rotator.php'
def get_context_ajax(html):
headers = {
'Origin': 'http://tovaripohudeniya.ru',
'Accept-Encoding': 'gzip, deflate',
'Accept-Language': 'en-US,en;q=0.8,ru;q=0.6',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',
'Accept': '*/*',
'Referer': 'http://tovaripohudeniya.ru/',
'Connection': 'keep-alive',
'Content-Length': '0',
'Cache-Control': 'max-age=0',
}
r = requests.post(html, headers=headers)
if r.ok:
return json.loads(r.text)
return []
if __name__ == '__main__':
content = get_context_ajax(BASE_URL)
img_info = {}
if content:
imgs = {item['img_path'] for item in content}
for item in content:
img_info[item['bot_text']] = imgs.difference([item['img_path']])
pprint(img_info)
The dictionary does not contain the "'{0}'.format(two)" key, so I suggest that you start debugging your code, at least by printing this unfortunate dictionary before accessing it.
But in the output I get the first element, everything is ok. And then everything breaks
In the language and input settings, there should be this, such as select languages \u200b\u200bfor this keyboard, and then it should show that the keyboard shortcut for changing the layout is CTRL + space
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question