How do I ignore one in the Python code

Asked

Viewed 65 times

-2

.download('C:\Users\Guilherme\Downloads')

I used Pytube and to download this folder I need to '', someone knows how I can ignore p work normally?

  • 2

    .download('C:\\Users\\Guilherme\\Downloads')?, [ref]

1 answer

-3

Could use the value r at the beginning of the string, to indicate to the compiler that it is a string raw. This way it is not necessary to do the escaping string. The final result would look like this:

.download(r'C:\Users\Guilherme\Downloads')

See the result of an execution:

 a = r'C:\Users\Guilherme\Downloads'
 a
 # 'C:\\Users\\Guilherme\\Downloads'
  • 2

    Interesting to circumvent the lock of the closed question (duplicated, to top it all)...

  • I was in the middle of writing when they closed. :-)

  • 1

    Hi there, Danizavtz. Just as an orientation, because your post has been flagged, I should advise you to search the site calmly before answering, simpler questions so probably already have answer(s) and in this case the ideal is to vote to close as duplicate, when the question is clear and good (well elaborated), it seems to be the case of this, so vote to close as duplicate, remember dups can coexist, as long as the dup is something that helps users to search and therefore avoid answering what probably already has answers.

  • for poorly elaborated questions choose another type of closure, which may vary, I recommend you read the tips of Stack Overflow Survival Guide in English

  • @Guilhermenascimento I understand it’s been flagged, but I can turn it into a good quality response.

  • @Danizavtz was not I who signaled, I said that his post was flagged, is not always a person who signals, in the case of his own system that indicated apparent problem (what may or may not be true, why the system only suggests me), but I will not go into details. I also did not speak of low-quality response, the guidance here is on dups questions. I recommend to read the link calmly, and follow the guidance I have already given you. If the guidance I passed was not clear can open a question on META. Thank you for understanding.

  • 1

    When so answer the marked question.

  • 1

    PS: I was told once when I started on the site, To answer closed question has to be very judicious, because unless you play a Lifeboat don’t do.

Show 3 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.