1568
备注:
|
2212
|
删除的内容标记成这样。 | 加入的内容标记成这样。 |
行号 91: | 行号 91: |
datediff.py {{{#!python import datetime a = datetime.date(*[int(i) for i in raw_input().split()]) b = datetime.date(*[int(i) for i in raw_input().split()]) print (a - b).days() }}} accept.py {{{#!python import socket import threading import select allsocks = [] def acc(): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind("", 2555) sock.listen(5) while 1: newsock, remote = sock.accept() allsocks.append(newsock) newthread = threading.Thread(target = acc) newthread.start() while 1: (rdsocks,,) = select.select(allsocks, [],[], 0.1) for s in rdsocks: msg = s.recv(100) }}} |
test.py
test2.py
wordscounter.py
test.py
1 class Person:
2 def __getitem__(self, key):
3 return key
4
5
6 p = Person()
7 s = Person()
8
9 Person.name = "Unknown"
10 p.name = "Jack"
11 p.gender = "Male"
12 p.age = 30
13 s.name = "Rose"
14 s.gender = "Female"
15
16 print Person
17 print p
18 print s
19 print Person.name
20 print p.name
21 print p.gender
22 print p.age
23 print s.name
24 print s.gender
25
26 print s[0]
multiply99.py
datediff.py
accept.py
1 import socket
2 import threading
3 import select
4 allsocks = []
5
6 def acc():
7 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
8 sock.bind("", 2555)
9 sock.listen(5)
10 while 1:
11 newsock, remote = sock.accept()
12 allsocks.append(newsock)
13
14
15 newthread = threading.Thread(target = acc)
16 newthread.start()
17
18 while 1:
19 (rdsocks,,) = select.select(allsocks, [],[], 0.1)
20 for s in rdsocks:
21 msg = s.recv(100)