NameError: name 'tcplink' is not defined

Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32
Type “copyright”, “credits” or “license()” for more information.

from turtle import *

RESTART: C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\tree.py

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/rect.py
Traceback (most recent call last):
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/rect.py”, line 57, in
draw_tree(l, 4)
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/rect.py”, line 41, in draw_tree
draw_tree(l, level + 1)
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/rect.py”, line 41, in draw_tree
draw_tree(l, level + 1)
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/rect.py”, line 41, in draw_tree
draw_tree(l, level + 1)
[Previous line repeated 1 more times]
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/rect.py”, line 47, in draw_tree
draw_tree(l, level + 1)
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/rect.py”, line 41, in draw_tree
draw_tree(l, level + 1)
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/rect.py”, line 47, in draw_tree
draw_tree(l, level + 1)
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/rect.py”, line 41, in draw_tree
draw_tree(l, level + 1)
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/rect.py”, line 41, in draw_tree
draw_tree(l, level + 1)
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/rect.py”, line 37, in draw_tree
lt(s)
File “”, line 5, in lt
turtle.Terminator

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/rect.py

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/rect.py

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/wjx.py

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/wjx.py

print(‘I’m ok.’)
I’m ok.

print(‘I’m learning\nPython.’)
I’m learning
Python.

print(’\\n\’)


SyntaxError: invalid syntax

ord(‘A’)
65

ord(‘中’)
20013

chr(66)
‘B’

chr(25991)
‘文’
SyntaxError: invalid syntax

ord(‘A’)
65
SyntaxError: multiple statements found while compiling a single statement

ord(‘中’)
20013

chr(66)
SyntaxError: unexpected indent

ord(‘中’)
20013

导入socket库:

import socket

创建一个socket:

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

建立连接:

s.connect((‘www.sina.com.cn’, 80))
SyntaxError: multiple statements found while compiling a single statement

import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((‘www.sina.com.cn’, 80))
s.send(b’GET / HTTP/1.1\r\nHost: www.sina.com.cn\r\nConnection: close\r\n\r\n’)
60

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/sina.py
HTTP/1.1 302 Moved Temporarily

Server: nginx

Date: Fri, 03 May 2019 10:44:03 GMT

Content-Type: text/html

Content-Length: 154

Connection: close

Location: https://www.sina.com.cn/

X-Via-CDN: f=edge,s=ctc.nanjing.ha2ts4.92.nb.sinaedge.com,c=221.225.76.253;

X-Via-Edge: 1556880243347fd4ce1dd7c5e66ca354cde61

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Traceback (most recent call last):
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py”, line 1, in
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
NameError: name ‘socket’ is not defined

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Waiting for connection…
Traceback (most recent call last):
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py”, line 16, in
t = threading.Thread(target=tcplink, args=(sock, addr))
NameError: name ‘threading’ is not defined

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Waiting for connection…

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Waiting for connection…
Traceback (most recent call last):
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py”, line 16, in
t = threading.Thread(target=tcplink, args=(sock, addr))
NameError: name ‘threading’ is not defined

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Waiting for connection…
Traceback (most recent call last):
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py”, line 16, in
t = threading.Thread(target=tcplink, args=(sock, addr))# abc
NameError: name ‘threading’ is not defined

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Traceback (most recent call last):
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py”, line 4, in
import thread
ModuleNotFoundError: No module named ‘thread’

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Waiting for connection…
Traceback (most recent call last):
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py”, line 16, in
t = threading.Thread(target=tcplink, args=(sock, addr))# abc
NameError: name ‘tcplink’ is not defined

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Traceback (most recent call last):
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py”, line 5, in
import tcplink
ModuleNotFoundError: No module named ‘tcplink’

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Waiting for connection…
Traceback (most recent call last):
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py”, line 17, in
t = threading.Thread(target=tcplink, args=(sock, addr))# abc
NameError: name ‘tcplink’ is not defined

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Waiting for connection…
Traceback (most recent call last):
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py”, line 17, in
t = threading.Thread(target=tcplinking, args=(sock, addr))
NameError: name ‘tcplinking’ is not defined

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Waiting for connection…
Traceback (most recent call last):
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py”, line 17, in
t = threading.Thread(target=tcp, args=(sock, addr))
NameError: name ‘tcp’ is not defined

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Waiting for connection…
Traceback (most recent call last):
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py”, line 17, in
t = threading.Thread(target=tcplink, args=(sock, addr))
NameError: name ‘tcplink’ is not defined

=============================== RESTART: Shell ===============================

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Waiting for connection…
Traceback (most recent call last):
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py”, line 17, in
t = threading.Thread(target=tcplink, args=(sock, addr))
NameError: name ‘tcplink’ is not defined

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Waiting for connection…
Traceback (most recent call last):
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py”, line 17, in
t = threading.Thread(target=client, args=(sock, addr))
NameError: name ‘client’ is not defined

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Waiting for connection…

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Traceback (most recent call last):
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py”, line 5, in
import tcp
ModuleNotFoundError: No module named ‘tcp’

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Traceback (most recent call last):
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py”, line 5, in
import tcplink
ModuleNotFoundError: No module named ‘tcplink’

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Waiting for connection…
Traceback (most recent call last):
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py”, line 18, in
t = threading.Thread(target=tcplink, args=(sock, addr))
NameError: name ‘tcplink’ is not defined

RESTART: C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\tree.py
Traceback (most recent call last):
File “C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\tree.py”, line 57, in
draw_tree(l, 4)
File “C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\tree.py”, line 42, in draw_tree
draw_tree(l, level + 1)
File “C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\tree.py”, line 42, in draw_tree
draw_tree(l, level + 1)
File “C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\tree.py”, line 42, in draw_tree
draw_tree(l, level + 1)
[Previous line repeated 2 more times]
File “C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\tree.py”, line 48, in draw_tree
draw_tree(l, level + 1)
File “C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\tree.py”, line 50, in draw_tree
lt(s)
File “”, line 5, in lt
turtle.Terminator

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Waiting for connection…
Traceback (most recent call last):
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py”, line 18, in
t = threading.Thread(target=t, args=(sock, addr))
NameError: name ‘t’ is not defined

RESTART: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py
Waiting for connection…
Traceback (most recent call last):
File “C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/server.py”, line 18, in
t = threading.Thread(target=tcplink, args=(sock, addr))
NameError: name ‘tcplink’ is not defined

你可能感兴趣的:(python)