Skip to content Skip to sidebar Skip to footer

I'm Trying To Get An Excel Sheet Downloaded Using Python Requests Module And Getting Junk Output

I'm trying to download an excel file which is uploaded on a Sharepoint 2013 site. My code is as follows: import requests url='https:///

Solution 1:

Its too late but i got similar issue... thought it might help someone else.

try writing the output to a file or apply some encoding while printing.

writing to a file:

file=open("./temp.xls", 'wb')
file.write(response.content)
file.close()

or

file=open("./temp.xls", 'wb')
file.write(response.text)
file.close()

printing with encoding

print ( resp.text.encode("utf-8") )

or

print ( resp.content.encode("utf-8") )

!Make appropriate imports. !try 'w' or 'wb' for file write.

Hope this helps.


Post a Comment for "I'm Trying To Get An Excel Sheet Downloaded Using Python Requests Module And Getting Junk Output"