문제

I'm using urllib.urlopen to read a file from a URL. What is the best way to get the filename? Do servers always return the Content-Disposition header?

Thanks.

도움이 되었습니까?

해결책

It's an optional header, so no. See if it exists, and if not then fall back to checking the URL.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top