S
S
Snowdevil2021-06-12 18:35:36
Python
Snowdevil, 2021-06-12 18:35:36

TypeError: 'Message' object is not subscriptable, why not subscriptable?

line 10, in get_text_messages
if _phone[0] == '+':
TypeError: 'Message' object is not subscriptable

def get_text_messages(message):
  if message.text == "/start":
    _phone = bot.send_message(message.from_user.id, "Введите номер телефона. Пример: 79xxxxxxxxx")

    if _phone[0] == '+':
      _phone = _phone[1:]
    if _phone[0] == '8':
      _phone = '7'+_phone[1:]
    if _phone[0] == '9':
      _phone = '7'+_phone
    if _phone[0] == '7':
      _phone = '7'+_phone
    else:
      bot.send_message(message.from_user.id, "Неправильно набран номер.")

Answer the question

In order to leave comments, you need to log in

11 answer(s)
S
soremix, 2021-06-12
@Snowdevil

1. Because the variable _phonecontains a class object Messagethat cannot be accessed like this through indices.
2. The code will not work. If you want to get user input use register_next_step_handler

M
mark_ablov, 2011-11-20
@mark_ablov

I usually watch the latest 3D results from the trunk.
www.ixbt.com/video3/i1011-video.shtml
There you can see, for example, that the Radeon card is better both in terms of performance and performance / price.

O
optemist, 2011-11-20
@optemist

And for what tasks? If purely for games, then the GeForce GTX 560. And if you want to work with OpenCL or play around with Bitcoin, etc. then Radeon HD 6870.

G
Genome_X, 2011-11-20
@Genome_X

Taking a Radeon card, you run the risk of being taken hostage by the developers of drivers for it. often they are crooked. This opinion is not unfounded, I dealt with both NVidia and Radeon cards. I have never had any problems with cards and drivers from NVidia. Everything has always worked correctly. Once, when I decided to change the video card, I decided to try something new, and I took a card from Radeon. Well, in one of the games left artifacts began to be observed, which were not there when I played the same game on an NVidia card. Watching various gaming forums, I often come across messages about the incorrect operation of the game on Radeon cards and with a suggestion to download the appropriate patch for them. What it is, the curvature of the hands of game developers (moreover, several games independent of each other at once), or developers of drivers for a video card from Radeon, I don’t know.
Of course, it all depends on the goals, and when working exclusively for standard purposes, there is practically no difference.

M
mukizu, 2011-11-20
@mukizu

Your question should have sounded more like "Choice of video processor" or something like that. For there are a lot of cards on both the Radeon HD 6870 and the GeForce GTX 560.
I ended up recently opting for the MSI N560GTX-Ti Twin Frozr OC

S
Shirixae, 2011-11-20
@Shirixae

6870 of course.

R
rPman, 2011-11-20
@rPman

complete the question with tasks!
But in practice, an NVIDIA card may be needed only if the programs require CUDA (as well as games that support only PhysX hardware acceleration) ... in all other cases it is more profitable to take ATI

Y
YujiTFD, 2011-11-20
@YujiTFD

If you want the absence of problems and maximum versatility - NVIDIA, in other cases, you can consider AMD.

A
Alex42rus, 2011-11-20
@Alex42rus

I'll add on my own, I saw an article on overs, and so, ATI video cards are less demanding on the processor, if you have a budget AMD, you should probably take a closer look at ATI.

V
Vapp, 2011-11-20
@Vapp

www.nix.ru/hardware-review/video-graphics-gpu-benchmark-performance.html

T
tick, 2011-11-20
@tick

If you want 3D stereo, then NVidia is better - they have a built-in solution.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question