1

I'm developing a telegram bot with python.

I ask users to input their phone numbers. The problem is, if they enter Persian numbers (like ۰۶۰۷۵۰), their data doesn't set in my database, and after updating database its field is empty!

But if they enter English digits, it saves in database?!

  • python 3.7
  • database: MySQL
  • OS: win 10
Shadow
  • 33,525
  • 10
  • 51
  • 64
mahyar madani
  • 21
  • 1
  • 5

2 Answers2

4

Convert to the string and save it later in the database

Use the number to convert the number to the number

database----> '۰۶۰۷۵۰'

using ---> get database-----> int('۰۶۰۷۵۰')

Reza Bojnordi
  • 703
  • 5
  • 15
0

thanks

I solved it without any change to my database!

phone_number = str(phone_number)
print('str:    ', phone_number)
print('str type:    ', type(phone_number))

phone_number = int(phone_number)
print('int:    ', phone_number)
print('int type:    ', type(phone_number))
mahyar madani
  • 21
  • 1
  • 5