S
S
sswwssww2021-02-16 17:53:53
Python
sswwssww, 2021-02-16 17:53:53

Why does Python create two copies of files when writing with open()?

with open(f"./captcha/{cls.count}.jpeg", "wb") as f:
    f.write(await captcha_res.read())

I want to write a file, with this construction, a file appears in the current directory with the name "./captcha/1.jpeg" (this is the whole file name) , and in the directory I need \captcha\ 1.jpeg (the file name is 1.jpeg and it is stored in the captcha folder)
OS Ubuntu 20.4.
602bdc78da6b5279160642.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dr. Bacon, 2021-02-16
@sswwssww

Well, you most likely started to make slashes in the other direction, launched it, so you created such crooked files, then made the correct slashes, confused it, created it in the right folder.

G
giv5, 2017-10-03
@giv5

bezopasnik.org/article/book/index.htm - look here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question