Skip to content

Commit 157cdca

Browse files
committed
1.web相关
1 parent 9898cdf commit 157cdca

File tree

8 files changed

+139
-15
lines changed

8 files changed

+139
-15
lines changed

.idea/dataSources.xml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import threading
2+
3+
localThread=threading.local()
4+
5+
def thread_fun(param):
6+
localThread.arg=param
7+
print(threading.current_thread().name,localThread.arg)
8+
9+
10+
th1=threading.Thread(target=thread_fun,args=('Lucy',))
11+
th2=threading.Thread(target=thread_fun,args=('Jack',))
12+
th3=threading.Thread(target=thread_fun,args=('Lily',))
13+
14+
th1.start()
15+
th2.start()
16+
th3.start()
17+
# th1.join()
18+
# th2.join()
Lines changed: 69 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,86 @@
1-
from tkinter import *
2-
from tkinter.ttk import Frame, Label, Button
3-
import tkinter.messagebox as messagebox
1+
# from tkinter import *
2+
# from tkinter.ttk import Frame, Label, Button
3+
# import tkinter.messagebox as messagebox
4+
#
5+
#
6+
#
7+
# class Application(Frame):
8+
# def __init__(self, master=None):
9+
# Frame.__init__(self, master)
10+
# self.pack()
11+
# self.createWidgets()
12+
#
13+
# def createWidgets(self):
14+
# self.helloLabel = Label(self, text='Hello, world!')
15+
# self.helloLabel.pack()
16+
# self.quitButton = Button(self, text='Quit', command=self.quit)
17+
# self.quitButton.pack()
18+
#
19+
# def hello(self):
20+
# name = self.nameInput.get() or 'world'
21+
# messagebox.showinfo('Message', 'Hello, %s' % name)
22+
#
23+
#
24+
# app = Application()
25+
# # 设置窗口标题:
26+
# app.master.title('Hello World')
27+
# # 主消息循环:
28+
# app.mainloop()
429

530

631

32+
from tkinter import messagebox
33+
from tkinter.ttk import *
34+
35+
736
class Application(Frame):
837
def __init__(self, master=None):
938
Frame.__init__(self, master)
1039
self.pack()
1140
self.createWidgets()
1241

1342
def createWidgets(self):
14-
self.helloLabel = Label(self, text='Hello, world!')
15-
self.helloLabel.pack()
16-
self.quitButton = Button(self, text='Quit', command=self.quit)
17-
self.quitButton.pack()
43+
self.nameInput = Entry(self)
44+
self.nameInput.pack()
45+
self.alertButton = Button(self, text='Hello', command=self.hello)
46+
self.alertButton.pack()
1847

1948
def hello(self):
20-
name = self.nameInput.get() or 'world'
21-
messagebox.showinfo('Message', 'Hello, %s' % name)
49+
name = self.nameInput.get() or 'world'
50+
messagebox.showinfo('Message', 'Hello, %s' % name)
2251

2352

2453
app = Application()
2554
# 设置窗口标题:
26-
app.master.title('Hello World')
55+
app.master.title('Hello World1111')
2756
# 主消息循环:
28-
app.mainloop()
57+
app.mainloop()
58+
59+
60+
61+
62+
63+
64+
65+
66+
67+
68+
69+
70+
71+
72+
73+
74+
75+
76+
77+
78+
79+
80+
81+
82+
83+
84+
85+
86+
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
from turtle import *
2-
3-
4-
1+
from turtle import *
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# hello.py
2+
3+
def application(environ, start_response):
4+
start_response('200 OK', [('Content-Type', 'text/html')])
5+
return [b'<h1>Hello, web!</h1>']
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from wsgiref.simple_server import make_server
2+
3+
# from Hello import application
4+
5+
6+
def application(environ, start_response):
7+
start_response('200 OK', [('Content-Type', 'text/html')])
8+
return [b'<h1>Hello, web!</h1>']
9+
10+
11+
12+
# 创建一个服务器,IP地址为空,端口是8000,处理函数是application:
13+
httpd = make_server('', 8000, application)
14+
print('Serving HTTP on port 8000...')
15+
# 开始监听HTTP请求:
16+
httpd.serve_forever()

com/newtest/05-网络编程/网络编程_MySql.py

Whitespace-only changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import sqlite3
2+
3+
conn = sqlite3.connect('test.db')
4+
5+
cursor = conn.cursor()
6+
7+
cursor.execute('create table user (id varchar(20) primary key, name varchar(20))')
8+
9+
cursor.execute('insert into user (id, name) values (\'1\', \'Michael\')')
10+
11+
12+
print(cursor.rowcount)
13+
14+
cursor.close()
15+
16+
conn.commit()

0 commit comments

Comments
 (0)