Fortune Telling Collection - Zodiac Analysis - Lexb constellation _lex what constellation

Lexb constellation _lex what constellation

How to open python Code Running Assistant

Python code running assistant is a tool that can run Python language on web pages. Because the python running environment in many tutorials is dos and the dark interface is a bit crude, this python code running assistant is developed as an ide.

In fact, the python code running assistant interface can only be counted as a passing score. If you are looking for an ide, it is recommended to use jupyter. Jupyter is integrated into ANACONDA and can be used as long as anacoda is installed.

Back to this question:

1. To open this running assistant, you must first download a learning.py. If you can't find it, you can copy the following code and save it as "learning.py". The editor uses sublime or notepad++.

#! /usr/bin/env? python3

#? -*-? Code:? utf-8? -*-

' r ' ' '

Learning.py

Answer? Python? 3? Tutorial? From where?

Usage:

python3? Learning.py

'''

Import? System copy command (short for system)

def? Check version ():

v? =? System version information

What if? V. major ==? 3? And then what? Minor? & gt=? 4:

Return? real

Print ('Yours? Currently? python? Is it? %d.%d? Please. Use? Python? 3.4.'? %? (v. major,? V. Minors))

Return? wrong

What if? Isn't it? Check version ():

Exit (1)

Import? os,? Io? json,? Subprocess? temporary file

From where? urllib? Import? Grammatically analyze

From where? wsgiref.simple_server? Import? Production server

EXEC? =? sys.executable

Port? =? 39093

Moderator? =? local.liaoxuefeng.com:%d '? %? port

Temporary workers? =? Tempfile.mkdtemp (suffix ='_py',? Prefix ='learn_python_')

Index? =? 0

def? main():

')? ==? - 1:

start_response('400? Not good? Request',? [('Content Type',? application/json')])

Return? [b ' { " error ":" invalid _ origin " } ']

headers . append((' Access-Control-Allow-Origin ',? Origin))

start_response('200? Okay? Title)

r? =? Dictionary ()

Try:

fpath? =? Write_py (name, code)

Print ('Execute:? %s? "%s"? %? (EXEC,? fpath))

R[' output']? =? decode(subprocess . check _ output([EXEC,fpath],? Stderr = subprocess. STDOUT,? Timeout =5))

Except? Sub process. CalledProcessError? As? e:

r? =? dict(error='Exception ',? Output = decoding (e. output))

Except? Sub process. Timeout expired? As? e:

r? =? dict(error='Timeout ',? Output =' execution timeout')

Except? Sub process. CalledProcessError? As? e:

r? =? dict(error='Error ',? Output= "execution error")

Print ('Execute? "Deal." )

Return? [json.dumps(r)。 Encoding ('utf-8')]

What if? __name__? ==? __main__ ':

Main() 2, and then write the following code in Notepad:

@echo? leave

python? Learning.py

Save the pause as Run. bat

3. Put "Run". "bat" and "learning.py" are in the same directory.

4. Double-click Run. Bat ",and then a black dos window will pop up. Don't close this window.

5. Enter the URL and port corresponding to the URL, and the whole process is completed.