Home > other >  Why the same code can run successfully in the IDLE, but display error in vscode 'GBK' code
Why the same code can run successfully in the IDLE, but display error in vscode 'GBK' code

Time:11-23

The import requests # call requests library
Res=requests. Get (' https://localprod.pandateacher.com/python-manuscript/crawler-html/spider-men5.0.html ')
# get web site source code, get the res is the Response of object
HTML=res. Text
# put the contents of res in the form of a string returns
Print (' response status code: 'res. Status_code) # check request correct response
# # print (HTML) printed page source code
Print (HTML)
Vscode in operation, a string of code above, coding errors, but python's own idle and pycharm running normal?

CodePudding user response:

The
reference
'GBK' codec can 't encode

Look your VSCode terminal is GBK code - "seems you Windows computer -" default encoding of CMD is GBK - "can't code? An error

Specific reasons: no (possibly) know, because you did not give details,

How to give specific details?
Reference:
Learn to map and post code - CSDN, BBS BBS Python beginner, small white common errors and problems
Screenshots posted: + formatted color highlighting code
Others can help you,
  • Related