sending numbers to arduino via python

Hi - I figured out how to send numbers from 0-9 to the arduino from python using Serial.read()-'0' . Is there a simple way to instead send a value larger than 0-9 to the arduino. Right now I turn on an LED to monitor whether the it is working. My plan is to turn on a stepper motor for a certain number of iterations. I want python to send the number of iterations to the arduino. Then I can assign that value (such as 32500) to the iteration counter that controls the motor. FYI I am a new to programming and dont have a great grasp of integers,bytes,strings, etc.

Heres the python code:

import serial
import time

arduino = serial.Serial(2, 9600, timeout = 1)
time.sleep(2)

while 1:
    
    command = str.encode('1')
    arduino.write(command)   
    time.sleep(1.5)

and the Arduino Code:

int led = 4;
int state = 0;

void setup() {
  pinMode(led, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  if (Serial.available() > 0) {
      state = Serial.read()- '0';
     
      if  (state == 1){
      digitalWrite(led, HIGH);
      delay(100);
      digitalWrite(led, LOW);
      Serial.println(state);
      }

    while (Serial.available() > 0)
    {
      Serial.read();
    }
  }

}
    command = str.encode('1')

What type is command supposed to be? What does encode do? Why do you think you need to encode anything?

    while (Serial.available() > 0)
    {
      Serial.read();
    }

You sent one character. You read one character. Why do you think that you need to dump random amounts of unread data?

The examples in serial input basics are simple reliable ways for the Arduino to receive data.

You may also be interested in this Python-Arduino demo.

...R