How to iterate name of output image name in blender via python? For example I want it to be something like:
RenderedImage1.png
RenderedImage2.png
and etc
How to do something like this?

Here's the code I have:

import bpy
from random import randint
from random import random
from random import uniform

ob = bpy.context.active_object

ob.particle_systems[-1].settings.hair_step = randint(0, 20)
ob.particle_systems[-1].settings.hair_step = randint(0, 20)

def render_image():
    if  bpy.context.scene.frame_current == 250:
        bpy.context.scene.render.filepath = 'BlenderRepository/RenderedImages/RenderedImage.png'
        bpy.context.scene.render.resolution_x = 1920
        bpy.context.scene.render.resolution_y = 1080
        bpy.ops.render.render(write_still=True)

render_image()
Just call RenderSettings.frame_path() which returns the absolute path to the filename for a given frame or concatenate your string like  ".../folder/image_" + str(250) + ".jpg"(error prone due to OS differences).

Proof using the Console:

&gt;&gt;&gt; rd = C.scene.render
&gt;&gt;&gt; rd.frame_path(frame=250)
'/tmp/0250.png'




For multiple render iterations, I'd suggest append the iterator to the filepath:

C = bpy.context
rd = C.scene.render

for r in range(1,3):
    path, ext = rd.frame_path(frame=250).rsplit('.', 1)
    multi_path = path + "_" + str(r) + "." + ext
    print (multi_path)


Terminal Output:

/tmp/0250_1.png
/tmp/0250_2.png