Не могу исправить ошибку (AttributeError: 'str' object has no attribute 'splint')

Не могу исправить ошибку: var = i.splint(':') AttributeError: 'str' object has no attribute 'splint'

from tkinter import*
from tkinter.ttk import*
from vk_api.longpoll import VkLongPoll, VkEventType
import vk_api

class Bot():

    def __init__(self, token, coms):
        self.commands = coms
        self.vk_session = vk_api.VkApi(token = token)
        self.vk = self.vk_session.get_api()
        self.longpoll = VkLongPoll(self.vk_session)
      

        def answer(self, id, msg):
            self.vk.messages.send(user_id = id,message = msg, rondom_id = 0)

        def get_msg(self):
            for event in self.longpoll.listen():
                if event.type == VkEventType.MESSAGE_NEW:
                    if event.to_me:

                       msg = event.text.lover_id
                       id = event.user_id

                       return id, msg

        def work(self):
            while True:
                inf = self.get_msg()
                if inf:
                    print(inf)
                    id = inf[0]
                    msg = inf[1]

                    if msg in self.commands:
                        self.answer(id, self.commands[msg])
                    else:
                        self.answer(id, 'хз чё ответить') 

root = Tk()
root.geometry('800x500')
root.title('Boter')
root.resizable(False, False)
root.configure()

label1 = Label(root)
label1.configure(text = 'Сценарии:')
label1.place(x = 0, y = 0, height = 20, widt = 300)

label2 = Label(root)
label2. configure(text = 'Ваш Токен  ')
label2.place(x = 0, y = 0, height = 20, widt = 500)

instruction = Label(root)
instruction.configure(text = 'Для того, чтобы создать своего бата вам нужна своя группа в вк')
instruction.place(x = 0, y = 41,height = 400,  widt = 500)

body = StringVar()
token_entru = Entry(root, textvariable = body).place(x = 0, y = 21,height = 20,  widt = 500)

main_slow = Text(root)
main_slow.place(x = 500, y = 21,height = 379,  widt = 300)

main_com = {}
def check():
    global main_slow, main_com, body
    tok = str(body.get())
    print(tok)
    mas = main_slow.get(1.0, END).split('\n')
    for i in mas:
        if ':' in i :    
            var = i.splint(':')
            var[0] = var[0].strip()
            var[1] = var[1].strip()
            k = {f'var[0]' : f'{var[1]}'}
            main_com.update(k)
    print(main_com)
    botik = Bot(tok, main_com)
    botik.work()  


mbtn = Button(root, text = 'Старт', command = check ).place(x = 500, y = 400,  widt = 300)

root.mainloop()

ошибку я исправил спасибо большое теперь выскочила новая- File "c:/Users/Олег/Desktop/Test/main.py", line 76, in check k = {f'{var[2]} : f,{var[1]}'} IndexError: list index out of range


Ответы (1 шт):

Автор решения: Tehnorobot

У строки нет атрибута splint, но есть split:

var = i.split(':')

Подробнее о методах строк вы можете посмотреть здесь

→ Ссылка