# -*- coding: utf-8 -*- #python 27 #xiaodeng #python之模块 os import os ''' FUNCTIONS abort(...)#暂不了解 abort() -> does not return! Abort the interpreter immediately. This 'dumps core' or otherwise fails in the hardest way possible on the hosting operatin
python重要模块之subprocess模块 我们经常要通过python去执行系统的命令或者脚本,系统的shell命令是独立于你的python进程之外的,每执行一条命令,就相当于发起了一个新的进程,通过python调用系统命令或脚本的模块. 之前我们也学到过和系统交互的模块-os模块 In [1]: import os In [2]: os.system('uname -a') Linux host-10-200-137-195 3.10.0-693.21.1.el7.x86_64 #1 SM
先看一个很简单的例子 #coding:utf8 import Queue #queue是队列的意思 q=Queue.Queue(maxsize=10) #创建一个queue对象 for i in range(9): q.put(i) #放入元素 while not q.empty():#检测元素是否为空 print q.get(),#读取元素 #默认为先进先出 如果需要一个无限长或者先进后出的队列 #创建一个无限长的队列,如果maxsize小于1就表示队列长度无限. q1=Queue.Queue