python - shutil.copy gemmer filen

Indlæg af Hanne Mølgaard Plasc

Problem



from shutil import copy
import os

print("Preparation: put 3 followpoint files in your skin's folder; followpoint.png, followpoint@2x.png, and followpointblank.png. I think these names are self explanatory enough.")
thingything = input("Enter your animation pattern (. = blank, - = line) (example: ...------..): ")
inputs = list(thingything)

for i in range(len(inputs)):
    if inputs[i] == ".":
        copy("followpointblank.png", "followpoint-" + str((i + 1)) + ".png")
    if inputs[i] == "-":
        copy("followpoint.png", "followpoint-" + str((i + 1)) + ".png")
        copy("followpoint@2x.png", "followpoint-" + str((i + 1)) + "@2x.png")

os.remove("followpoint.png")
os.remove("followpoint@2x.png")
os.remove("followpointblank.png")


Når jeg forsøger at køre dette program, slutter det med at navngive filerne .followpoint-1.png i stedet for followpoint-1.png Jeg bruger Windows 10. Jeg vil ikke have det her.

Bedste reference