import os
lst = os.listdir(r"E:\Minecraft\Random_Appearance\Resourcepack\assets\minecraft\items")
with open("walk.mcfunction", 'a') as text:
    for i in range(27):
        text.write("execute as @a if score global ra.slot matches %d run function ra:select {slot: inventory.%d}\n"%(i, i))
    text.write("scoreboard players remove global ra.slot 1\n")
    text.write("execute if score global ra.slot matches 0.. run function ra:walk\n")