Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
please help me
#1
Smile 
import requests

response=requests.get('https://ac.search.naver.com/nx/ac?q=%EC%A3%BC%EC%8B%9D%20%E3%84%B1&con=0&frm=nv&ans=2&r_format=json&r_enc=UTF-8&r_unicode=0&t_koreng=1&run=2&rev=4&q_enc=UTF-8&st=100&_callback=_jsonp_5')
orgin_data = response.text
print(orgin_data)
Error:
NameError: name 'orgin_data' is not defined >>> print(orgindata) Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'orgindata' is not defined
code Problem or the other problem

thank you for reading, have a nice day
Reply
#2
Your error message does not match your code. The error message points to an error in "print(orgindata)". Your example code contains "print(orgin_data)". Also, it looks like "orgindata" is a variable in some file, but the error message says the error was in code typed into the Python console. Normally when you run a Python program (from a file) you do not have access to the variables. To access the variables after the program runs you either need to run the program in IDLE, or execute the program using the -i option.

From python --help
Quote:-i : inspect interactively after running script; forces a prompt even
if stdin does not appear to be a terminal; also PYTHONINSPECT=x

To use (from windows cmd shell):
Output:
c:\> python -y my_program.py ... output produced by program ... >>> can type python commands here
Try again and please post the code that generated the error this time.
buran likes this post
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020