背景:Python脚本:读取文件中每行,放入列表中;循环读取列表中的每个元素,并做处理操作。
核心:多线程处理单个for循环函数调用

模块:threading

第一部分:
 
:多线程脚本 (该脚本只有两个线程,t1循环次数<t2)
 
#!/usr/bin/env python
#-*- coding: utf8 -*- import sys
import time
import string
import threading
import datetime
fileinfo = sys.argv[1] # 读取文件内容放入列表
host_list = []
port_list = [] # 定义函数:读取文件内容放入列表中
def CreateList():
f = file(fileinfo,'r')
for line in f.readlines():
host_list.append(line.split(' ')[0])
port_list.append(line.split(' ')[1])
return host_list
return port_list
f.close() # 单线程 循环函数,注释掉了
#def CreateInfo():
# for i in range(0,len(host_list)): # 单线程:直接循环列表
# time.sleep(1)
# TimeMark = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
# print "The Server's HostName is %-15s and Port is %-4d !!! [%s]" % (host_list[i],int(port_list[i]),TimeMark)
# # 定义多线程循环调用函数
def MainRange(start,stop): #提供列表index起始位置参数
for i in range(start,stop):
time.sleep(1)
TimeMark = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
print "The Server's HostName is %-15s and Port is %-4d !!! [%s]" % (host_list[i],int(port_list[i]),TimeMark) # 执行函数,生成列表
CreateList()
# 列表分割成:两部分 mid为列表的index中间位置
mid = int(len(host_list)/2) # 多线程部分
threads = []
t1 = threading.Thread(target=MainRange,args=(0,mid))
threads.append(t1)
t2 = threading.Thread(target=MainRange,args=(mid,len(host_list)))
threads.append(t2) for t in threads:
t.setDaemon(True)
t.start()
t.join()
print "ok"
以上是脚本内容!!!

----------------------------------------------------------------------

:读取文件的内容
文件内容:

[root@monitor2 logdb]# cat hostinfo.txt
192.168.10.11 1011
192.168.10.12 1012
192.168.10.13 1013
192.168.10.14 1014
192.168.10.15 1015
192.168.10.16 1016
192.168.10.17 1017
192.168.10.18 1018
192.168.10.19 1019
192.168.10.20 1020
192.168.10.21 1021
192.168.10.22 1022
192.168.10.23 1023
192.168.10.24 1024
192.168.10.25 1025

 
:输出结果:
单线程 : 执行脚本:输出结果:
[root@monitor2 logdb]# ./Threadfor.py hostinfo.txt
The Server's HostName is 192.168.10.10   and Port is 1010 !!! [2017-01-10 14:25:]
The Server's HostName is 192.168.10.11   and Port is 1011 !!! [2017-01-10 14:25:]
The Server's HostName is 192.168.10.12   and Port is 1012 !!! [2017-01-10 14:25:]
     .
     .
     .
The Server's HostName is 192.168.10.25   and Port is 1025 !!! [2017-01-10 14:25:]
 
多线程:执行脚本:输出 结果

[root@monitor2 logdb]# ./Threadfor.py hostinfo.txt
The Server's HostName is 192.168.10.11 and Port is 1011 !!! [2017-01-10 14:51:]
The Server's HostName is 192.168.10.18 and Port is 1018 !!! [2017-01-10 14:51:51]
The Server's HostName is 192.168.10.12 and Port is 1012 !!! [2017-01-10 14:51:]
The Server's HostName is 192.168.10.19 and Port is 1019 !!! [2017-01-10 14:51:52]
The Server's HostName is 192.168.10.13 and Port is 1013 !!! [2017-01-10 14:51:]
The Server's HostName is 192.168.10.20 and Port is 1020 !!! [2017-01-10 14:51:53]
The Server's HostName is 192.168.10.14 and Port is 1014 !!! [2017-01-10 14:51:]
The Server's HostName is 192.168.10.21 and Port is 1021 !!! [2017-01-10 14:51:54]
The Server's HostName is 192.168.10.15 and Port is 1015 !!! [2017-01-10 14:51:]
The Server's HostName is 192.168.10.22 and Port is 1022 !!! [2017-01-10 14:51:55]
The Server's HostName is 192.168.10.16 and Port is 1016 !!! [2017-01-10 14:51:]
The Server's HostName is 192.168.10.23 and Port is 1023 !!! [2017-01-10 14:51:56]
The Server's HostName is 192.168.10.17 and Port is 1017 !!! [2017-01-10 14:51:]
The Server's HostName is 192.168.10.24 and Port is 1024 !!! [2017-01-10 14:51:57]
The Server's HostName is 192.168.10.25 and Port is 1025 !!! [2017-01-10 14:51:58]

==================================以上部分完结===正确=========

=====经过调试出现新的问题======================================

第二部分:延伸问题

总结:以上运行结果没有问题!!!(但是调整参数:start,stop之后有问题:MainRange(start,stop))

首先说明下两个概念问题:

  join():

    1.方法的位置是在for循环外的,也就是说必须等待for循环里的两个进程都结束后,才去执行主进程(主进程指:本脚本中的print “OK”)。

    2.可以理解成:t.join() 的t线程执行完之后,再继续执行后面的!!!(本脚本中的t.join(),是指t2线程)

    可参考:

      for i in range(0,4):

        pass

      print i

      结果输出:3. 也就是for循环的最后一个i. 放在本脚本里,就是for循环的最后一个线程t2。然后t2完成之后,就是:print “OK”

        

  setDaemon(True):

    1.将线程声明为守护线程,必须在start() 方法调用之前设置,如果不设置为守护线程程序会被无限挂起。

    2.换句话说:开启,子线程不会挂起,主线程执行了,子线程及时没执行完也会中断:比如本脚本里如果:t1>t2

===========解析=============================================================

重新编写输出文件内容:

[root@monitor2 logdb]# cat hostinfo.txt
192.168.10.00 0
192.168.10.01 1
192.168.10.02 2
192.168.10.03 3
192.168.10.04 4
192.168.10.05 5
192.168.10.06 6
192.168.10.07 7
192.168.10.08 8
192.168.10.09 9
192.168.10.10 10
192.168.10.11 11
192.168.10.12 12
192.168.10.13 13
192.168.10.14 14

原文脚本中:

for t in threads:
t.setDaemon(True)
t.start()
t.join()
print "ok" 分类解析:

基于原文脚本:

1. 以上基于线程执行次数:t1 <= t2  运行结果:正确

[root@monitor2 logdb]# ./Threadfor.py hostinfo.txt
The Server's HostName is 192.168.10.00   and Port is 00 !!! [2017-01-10 19:08:44],
The Server's HostName is 192.168.10.07   and Port is 07 !!! [2017-01-10 19:08:44],
The Server's HostName is 192.168.10.01   and Port is 01 !!! [2017-01-10 19:08:45],
The Server's HostName is 192.168.10.08   and Port is 08 !!! [2017-01-10 19:08:45],
The Server's HostName is 192.168.10.02   and Port is 02 !!! [2017-01-10 19:08:46],
The Server's HostName is 192.168.10.09   and Port is 09 !!! [2017-01-10 19:08:46],
The Server's HostName is 192.168.10.03   and Port is 03 !!! [2017-01-10 19:08:47],
The Server's HostName is 192.168.10.10   and Port is 10 !!! [2017-01-10 19:08:47],
The Server's HostName is 192.168.10.04   and Port is 04 !!! [2017-01-10 19:08:48],
The Server's HostName is 192.168.10.11   and Port is 11 !!! [2017-01-10 19:08:48],
The Server's HostName is 192.168.10.05   and Port is 05 !!! [2017-01-10 19:08:49],
The Server's HostName is 192.168.10.12   and Port is 12 !!! [2017-01-10 19:08:49],
The Server's HostName is 192.168.10.06   and Port is 06 !!! [2017-01-10 19:08:50],
The Server's HostName is 192.168.10.13   and Port is 13 !!! [2017-01-10 19:08:50],
The Server's HostName is 192.168.10.14   and Port is 14 !!! [2017-01-10 19:08:51],
ok

  解析:开启setDaemon(True),t1,t2同时依次执行,[t1,t2],[t1,t2],[t1,t2],[t1,t2],[t1,t2] . . . . . .[t1,t2], 下次循环t1结束,t2再执行一次,[,t2],再下次,t2结束。t.join()==t2.join() 完成任务,继续执行主进程print “ok”

2.基于脚本中线程次数t1>t2,运行结果:错误

[root@monitor2 logdb]# ./Threadfor.py hostinfo.txt
t1: (0~13)
t2: (7~15)
The Server's HostName is 192.168.10.00   and Port is 00 !!! [2017-01-10 19:18:58],
The Server's HostName is 192.168.10.07   and Port is 07 !!! [2017-01-10 19:18:58],
The Server's HostName is 192.168.10.01   and Port is 01 !!! [2017-01-10 19:18:59],
The Server's HostName is 192.168.10.08   and Port is 08 !!! [2017-01-10 19:18:59],
The Server's HostName is 192.168.10.02   and Port is 02 !!! [2017-01-10 19:19:00],
The Server's HostName is 192.168.10.09   and Port is 09 !!! [2017-01-10 19:19:00],
The Server's HostName is 192.168.10.03   and Port is 03 !!! [2017-01-10 19:19:01],
The Server's HostName is 192.168.10.10   and Port is 10 !!! [2017-01-10 19:19:01],
The Server's HostName is 192.168.10.04   and Port is 04 !!! [2017-01-10 19:19:02],
The Server's HostName is 192.168.10.11   and Port is 11 !!! [2017-01-10 19:19:02],
The Server's HostName is 192.168.10.12   and Port is 12 !!! [2017-01-10 19:19:03],
The Server's HostName is 192.168.10.05   and Port is 05 !!! [2017-01-10 19:19:03],
The Server's HostName is 192.168.10.13   and Port is 13 !!! [2017-01-10 19:19:04],
The Server's HostName is 192.168.10.06   and Port is 06 !!! [2017-01-10 19:19:04],
The Server's HostName is 192.168.10.07   and Port is 07 !!! [2017-01-10 19:19:05],
The Server's HostName is 192.168.10.14   and Port is 14 !!! [2017-01-10 19:19:05],
ok

  解析:t1,t2同时依次执行,t1>t2,当t2执行最后一次时,t.join()===t2.join(),t.join()完成任务,执行主程序print "ok",由于:开启setDaemon(True),t1,t2均不会被挂起,主程序结束,子程序即使没有执行完,也结束。如上述结果。

  t2执行8次结束,t1也执行8次循环结束。

开启:t.setDaemon(True):不会挂起,顺序执行

1.脚本如下:

for t in threads:

  t.setDaemon(True)

  t.start()

  t.join()   #在for循环里面

print "ok"

[root@monitor2 logdb]# ./Threadfor.py hostinfo.txt
t1: (0~13)
t2: (7~15)
The Server's HostName is 192.168.10.00   and Port is 00 !!! [2017-01-10 19:30:56]
The Server's HostName is 192.168.10.01   and Port is 01 !!! [2017-01-10 19:30:57]
The Server's HostName is 192.168.10.02   and Port is 02 !!! [2017-01-10 19:30:58]
The Server's HostName is 192.168.10.03   and Port is 03 !!! [2017-01-10 19:30:59]
The Server's HostName is 192.168.10.04   and Port is 04 !!! [2017-01-10 19:31:00]
The Server's HostName is 192.168.10.05   and Port is 05 !!! [2017-01-10 19:31:01]
The Server's HostName is 192.168.10.06   and Port is 06 !!! [2017-01-10 19:31:02]
The Server's HostName is 192.168.10.07   and Port is 07 !!! [2017-01-10 19:31:03]
The Server's HostName is 192.168.10.08   and Port is 08 !!! [2017-01-10 19:31:04]
The Server's HostName is 192.168.10.09   and Port is 09 !!! [2017-01-10 19:31:05]
The Server's HostName is 192.168.10.10   and Port is 10 !!! [2017-01-10 19:31:06]
The Server's HostName is 192.168.10.11   and Port is 11 !!! [2017-01-10 19:31:07]
The Server's HostName is 192.168.10.12   and Port is 12 !!! [2017-01-10 19:31:08]
The Server's HostName is 192.168.10.07   and Port is 07 !!! [2017-01-10 19:31:09]
The Server's HostName is 192.168.10.08   and Port is 08 !!! [2017-01-10 19:31:10]
The Server's HostName is 192.168.10.09   and Port is 09 !!! [2017-01-10 19:31:11]
The Server's HostName is 192.168.10.10   and Port is 10 !!! [2017-01-10 19:31:12]
The Server's HostName is 192.168.10.11   and Port is 11 !!! [2017-01-10 19:31:13]
The Server's HostName is 192.168.10.12   and Port is 12 !!! [2017-01-10 19:31:14]
The Server's HostName is 192.168.10.13   and Port is 13 !!! [2017-01-10 19:31:15]
The Server's HostName is 192.168.10.14   and Port is 14 !!! [2017-01-10 19:31:16]
ok

  :解析:t.join()在for循环里面,t1.join()等待t1执行13次循环完毕;然后才执行t2,t2.join()等待t2循环执行8次;然后执行主线程print"ok"

   :如上述结果:t1先执行完,再执行t2

  :t1,t2大小无所谓,多线程没有效果

关闭:t.setDaemon(True) :线程会挂起

1.脚本如下:

for t in threads:

#  t.setDaemon(True)

  t.start()

  t.join()   #在for循环里面

print "ok"

[root@monitor2 logdb]# ./Threadfor.py hostinfo.txt
t1: (0~13)
t2: (7~15)
The Server's HostName is 192.168.10.00   and Port is 00 !!! [2017-01-10 19:37:11]
The Server's HostName is 192.168.10.01   and Port is 01 !!! [2017-01-10 19:37:12]
The Server's HostName is 192.168.10.02   and Port is 02 !!! [2017-01-10 19:37:13]
The Server's HostName is 192.168.10.03   and Port is 03 !!! [2017-01-10 19:37:14]
The Server's HostName is 192.168.10.04   and Port is 04 !!! [2017-01-10 19:37:15]
The Server's HostName is 192.168.10.05   and Port is 05 !!! [2017-01-10 19:37:16]
The Server's HostName is 192.168.10.06   and Port is 06 !!! [2017-01-10 19:37:17]
The Server's HostName is 192.168.10.07   and Port is 07 !!! [2017-01-10 19:37:18]
The Server's HostName is 192.168.10.08   and Port is 08 !!! [2017-01-10 19:37:19]
The Server's HostName is 192.168.10.09   and Port is 09 !!! [2017-01-10 19:37:20]
The Server's HostName is 192.168.10.10   and Port is 10 !!! [2017-01-10 19:37:21]
The Server's HostName is 192.168.10.11   and Port is 11 !!! [2017-01-10 19:37:22]
The Server's HostName is 192.168.10.12   and Port is 12 !!! [2017-01-10 19:37:23]
The Server's HostName is 192.168.10.07   and Port is 07 !!! [2017-01-10 19:37:24]
The Server's HostName is 192.168.10.08   and Port is 08 !!! [2017-01-10 19:37:25]
The Server's HostName is 192.168.10.09   and Port is 09 !!! [2017-01-10 19:37:26]
The Server's HostName is 192.168.10.10   and Port is 10 !!! [2017-01-10 19:37:27]
The Server's HostName is 192.168.10.11   and Port is 11 !!! [2017-01-10 19:37:28]
The Server's HostName is 192.168.10.12   and Port is 12 !!! [2017-01-10 19:37:29]
The Server's HostName is 192.168.10.13   and Port is 13 !!! [2017-01-10 19:37:30]
The Server's HostName is 192.168.10.14   and Port is 14 !!! [2017-01-10 19:37:31]
ok

  解析:由于t.join()在循环里面,所以:t1线程执行完,才执行t2.是顺序执行的

  t1,t2大小无所谓,多线程没有效果

2.脚本如下:

for t in threads:

#  t.setDaemon(True)

  t.start()

t.join()   #在for循环外面

print "ok"

[root@monitor2 logdb]# ./Threadfor.py hostinfo.txt
t1: (0~13)
t2: (7~15)
The Server's HostName is 192.168.10.00   and Port is 00 !!! [2017-01-10 19:40:31]
The Server's HostName is 192.168.10.07   and Port is 07 !!! [2017-01-10 19:40:31]
The Server's HostName is 192.168.10.01   and Port is 01 !!! [2017-01-10 19:40:32]
The Server's HostName is 192.168.10.08   and Port is 08 !!! [2017-01-10 19:40:32]
The Server's HostName is 192.168.10.02   and Port is 02 !!! [2017-01-10 19:40:33]
The Server's HostName is 192.168.10.09   and Port is 09 !!! [2017-01-10 19:40:33]
The Server's HostName is 192.168.10.03   and Port is 03 !!! [2017-01-10 19:40:34]
The Server's HostName is 192.168.10.10   and Port is 10 !!! [2017-01-10 19:40:34]
The Server's HostName is 192.168.10.04   and Port is 04 !!! [2017-01-10 19:40:35]
The Server's HostName is 192.168.10.11   and Port is 11 !!! [2017-01-10 19:40:35]
The Server's HostName is 192.168.10.05   and Port is 05 !!! [2017-01-10 19:40:36]
The Server's HostName is 192.168.10.12   and Port is 12 !!! [2017-01-10 19:40:36]
The Server's HostName is 192.168.10.06   and Port is 06 !!! [2017-01-10 19:40:37]
The Server's HostName is 192.168.10.13   and Port is 13 !!! [2017-01-10 19:40:37]
The Server's HostName is 192.168.10.07   and Port is 07 !!! [2017-01-10 19:40:38]
The Server's HostName is 192.168.10.14   and Port is 14 !!! [2017-01-10 19:40:38]
ok
The Server's HostName is 192.168.10.08   and Port is 08 !!! [2017-01-10 19:40:39]
The Server's HostName is 192.168.10.09   and Port is 09 !!! [2017-01-10 19:40:40]
The Server's HostName is 192.168.10.10   and Port is 10 !!! [2017-01-10 19:40:41]
The Server's HostName is 192.168.10.11   and Port is 11 !!! [2017-01-10 19:40:42]
The Server's HostName is 192.168.10.12   and Port is 12 !!! [2017-01-10 19:40:43]

  解析:t.join()在循环外面t.join()==t2.join(),

  过程:t1>t2. 开始:同时执行。当t2执行8次循环完毕,t1也执行了8次。此时t2完毕,t.join()生效,会执行主进程print "ok". 主进程完毕。

    由于,关闭:t.setDaemon(True),未执行完毕的t1先前被挂起,接下来会继续,直到结束。如上述结果

  t1<t2 就不会出现这种情况了。多线程是有效的。但是主线程的输出位置,错误!!

=============解决方法================================

解决方式:

1.只有两个线程时

修改原脚本:临时解决t1>t2

for t in threads:

  t.setDaemon(True)

 t.start()  

threads[0].join()   #指定t1,结束

print "ok"

  解析:通过threads[0] 指定t1.join() ,等t1完成了,才执行主程序

2.多个线程时 也适用

for t in threads:

  t.start()

for t in threads:

  t.join()

print "ok"

  解析:多个线程都等待,等所有都完成之后。才执行主线程print "ok"

3.事例:3个线程

[root@monitor2 logdb]# ./Threadfor.py hostinfo.txt
t1: (0~4)  循环4次
t2: (4~11) 循环7次

t3: (11~15) 循环4次
The Server's HostName is 192.168.10.00   and Port is 00 !!! [2017-01-10 20:07:31]
The Server's HostName is 192.168.10.04   and Port is 04 !!! [2017-01-10 20:07:31]
The Server's HostName is 192.168.10.11   and Port is 11 !!! [2017-01-10 20:07:31]   1次
The Server's HostName is 192.168.10.01   and Port is 01 !!! [2017-01-10 20:07:32]
The Server's HostName is 192.168.10.05   and Port is 05 !!! [2017-01-10 20:07:32]
The Server's HostName is 192.168.10.12   and Port is 12 !!! [2017-01-10 20:07:32]  2次
The Server's HostName is 192.168.10.02   and Port is 02 !!! [2017-01-10 20:07:33]
The Server's HostName is 192.168.10.06   and Port is 06 !!! [2017-01-10 20:07:33]
The Server's HostName is 192.168.10.13   and Port is 13 !!! [2017-01-10 20:07:33]  3次
The Server's HostName is 192.168.10.03   and Port is 03 !!! [2017-01-10 20:07:34]
The Server's HostName is 192.168.10.07   and Port is 07 !!! [2017-01-10 20:07:34]
The Server's HostName is 192.168.10.14   and Port is 14 !!! [2017-01-10 20:07:34]  4次
The Server's HostName is 192.168.10.08   and Port is 08 !!! [2017-01-10 20:07:35]  5次
The Server's HostName is 192.168.10.09   and Port is 09 !!! [2017-01-10 20:07:36]  6次
The Server's HostName is 192.168.10.10   and Port is 10 !!! [2017-01-10 20:07:37]  7次
ok

Python多线程循环的更多相关文章

  1. python 多线程实现循环打印 abc

    python 多线程实现循环打印 abc 好久没写过python了, 想自己实践一下把 非阻塞版 import threading import time def print_a(): global ...

  2. Python 多线程教程:并发与并行

    转载于: https://my.oschina.net/leejun2005/blog/398826 在批评Python的讨论中,常常说起Python多线程是多么的难用.还有人对 global int ...

  3. python 多线程就这么简单(转)

    多线程和多进程是什么自行google补脑 对于python 多线程的理解,我花了很长时间,搜索的大部份文章都不够通俗易懂.所以,这里力图用简单的例子,让你对多线程有个初步的认识. 单线程 在好些年前的 ...

  4. python 多线程就这么简单(续)

    之前讲了多线程的一篇博客,感觉讲的意犹未尽,其实,多线程非常有意思.因为我们在使用电脑的过程中无时无刻都在多进程和多线程.我们可以接着之前的例子继续讲.请先看我的上一篇博客. python 多线程就这 ...

  5. 【跟我一起学Python吧】Python 多线程

    其实自我感觉Python的多线程很类似于Java的多线程机制,但是比JAVA的多线程更灵活.在早期的Python多线程实现中,采用了thread模块.例如: from time import ctim ...

  6. 关于python多线程编程中join()和setDaemon()的一点儿探究

    关于python多线程编程中join()和setDaemon()的用法,这两天我看网上的资料看得头晕脑涨也没看懂,干脆就做一个实验来看看吧. 首先是编写实验的基础代码,创建一个名为MyThread的  ...

  7. Python多线程和多进程谁更快?

    python多进程和多线程谁更快 python3.6 threading和multiprocessing 四核+三星250G-850-SSD 自从用多进程和多线程进行编程,一致没搞懂到底谁更快.网上很 ...

  8. 搞定python多线程和多进程

    1 概念梳理: 1.1 线程 1.1.1 什么是线程 线程是操作系统能够进行运算调度的最小单位.它被包含在进程之中,是进程中的实际运作单位.一条线程指的是进程中一个单一顺序的控制流,一个进程中可以并发 ...

  9. python多线程爬虫设计及实现示例

    爬虫的基本步骤分为:获取,解析,存储.假设这里获取和存储为io密集型(访问网络和数据存储),解析为cpu密集型.那么在设计多线程爬虫时主要有两种方案:第一种方案是一个线程完成三个步骤,然后运行多个线程 ...

随机推荐

  1. Servlet Cookie 处理

    Servlet Cookie 处理 Cookie 是存储在客户端计算机上的文本文件,并保留了各种跟踪信息.Java Servlet 显然支持 HTTP Cookie. 识别返回用户包括三个步骤: 服务 ...

  2. python 案例:使用BeautifuSoup4的爬虫

    我们以腾讯社招页面来做演示:http://hr.tencent.com/position.php?&start=10#a 使用BeautifuSoup4解析器,将招聘网页上的职位名称.职位类别 ...

  3. tcp/iP协议族——IP工作原理及实例具体解释(下)

     IP协议具体解释 上一篇文章文章主要介绍了IP服务的特点,IPv4头部结构IP分片.并用tcpdump抓取数据包,来观察IP数据报传送过程中IP的格式,以及分片的过程.本文主要介绍IP路由,IP ...

  4. window linux IPC ftok BY_HANDLE_FILE_INFORMATION

    看这题目就很乱,心情当然也是不怎么美好了.前一段时间做了一个项目,AIX(Unix的一种)中的一个系统向WINDOWS移植,开发环境由IBM的C/C++(叫什么忘记了,好像是xlC)变为VC++. 这 ...

  5. iOS - url中文和特殊字符转码###

    - (NSString *)generateUrl:(NSString *)url{ /** 第一个参数:NULL 第二个参数:C语言的字符串 第三个参数:NULL 第四个参数:要转义的字符串,不要乱 ...

  6. MySQL的语法高级之SELECT

    1.语法:select 字段列表 from  子句 [where 子句][group by 子句][ order by 子句][having 子句][limit 子句]; 注解: 1.where子句对 ...

  7. 当公有云Azure拥抱Docker容器技术

    本文转载至 http://3387405.blog.51cto.com/3377405/1598977 预见未来看似是一件不太可能的事情,然而现在企业科技高速发展的态势完全超乎想象. 就在几周前Inf ...

  8. 在看lua仿单继承

    --lua仿单继承 Account = { balance = } --对于成员变量,第一此访问要使用元表中的,在第一次也赋值到自己的域中了 --将不涉及到__index了 function Acco ...

  9. Android UI开发第二十九篇——Android中五种常用的menu(菜单)

    Android Menu在手机的应用中起着导航的作用,作者总结了5种常用的Menu. 1.左右推出的Menu 前段时间比较流行,我最早是在海豚浏览器中看到的,当时耳目一新.最早使用左右推出菜单的,听说 ...

  10. 巨蟒python全栈开发django8:基于对象和基于双下划线的多表查询

    1.编辑删除&&多对多关系的其他方法 提交,数据,得到结果 查看运行 给编辑和删除,添加样式 我们点击删除,可以成功删除 打印sql语句的,在settings.py里边的配置 LOGG ...