E
E
Emilka902022-04-21 07:12:23
Python
Emilka90, 2022-04-21 07:12:23

Why does a syntax error occur?

My code

if message.text.startswith('Сменить ник'):
        name = message.from_user.get_mention(as_html=True)
        nik = str(message.text.split()[2])

        await bot.send_message(message.chat.id, f'{name}, использование  Сменить ник [ник]',
        
            
    if str(nik) >= 16:
           await bot.send_message(message.chat.id, f'⛔Извините но  ник должен быть не менее 15 символов', 
        
    if str(nik) <= 15:
            await bot.send_message(message.chat.id, f'⚡Ник {️nik}, Успешно установлен ', 
                                   parse_mode='html')
                   cursor.execute(f'UPDATE users SET user_name = {nik} WHERE user_id = ?')
                    connect.commit()
                    return

Gives an error on startup
message: 

Exited with error status 1

stderr: 

File "script.py", line 6753 if str(nik) >= 16: ^ SyntaxError: invalid syntax

Answer the question

In order to leave comments, you need to log in

10 answer(s)
N
Nikolai Savelyev, 2022-04-21
@Emilka90

You are comparing string and int, but you can't do that

Z
Zzzz9, 2022-04-21
@Zzzz9

Presumably, count the spaces, if str(nik) >= 16:it is not clear what it refers to, either to the upper condition, or an independent condition.

V
Vindicar, 2022-04-21
@Vindicar

You have a parenthesis not closed in send_message() in a couple of places.
Well, yes, the condition str(something) >= number does not make any sense at all.

J
Jack444, 2022-04-21
@Jack444

Forgot to add linen.
len(str(nik)) >= 16:

Z
Zhainar, 2016-10-16
@zhainar

you should not have pushed the entire site into container

G
Grigory S., 2016-10-16
@Grigory90

Make a full-width map without any containers, and a block with info position: absolute, and select its offset using calc()

S
Sergey Goryachev, 2016-10-16
@webirus

At a glance, like this https://jsfiddle.net/webirus/ohugLhpv/
I think you can fix the little things and jambs yourself.

I
Igor Morev, 2016-10-16
@Gomerkucher

You can get the right border of the container via javascript, and position the desired part of the black box like this: right: the right border of the container. This will be as cross-browser friendly as possible. In general, there are often situations when you have to use javascript in a non-standard layout.

M
MaxFreedom, 2016-10-16
@RomanticOS

если я правильно понял, то поверх карты нужно расположить блок по центру. То я бы сделал так:
- внутри контейнера с картой создал бы div, с нужной шириной и высотой, а ценровал бы его margin: 0px auto;

L
Loot, 2016-10-16
@Cesavel

Думаю это вам подходит

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question