예제 #1
0
 def update_event(self, inp=-1):
     self.set_output_val(0, cgi.closelog())
예제 #2
0
파일: test.py 프로젝트: necromaner/Python
#continue:中断当前循环(跳过当前的这次循环,直接开始下一次循环

#str()转换成字符串
'''
函数定义的格式
def 函数名(参数):
   函数体
'''
def fan(i):
    print(i)
fan('wew')

#import 模块名
#from ... import ... 从某模块导入某个方法
import cgi
cgi.closelog()

from cgi import closelog
'''
模块的来源:
1、自带模块
2、第三方模块
3、自定义模块
'''

#文件的操作
print("\n文件的操作:")
#open(文件地址,操作形式)
'''
w:写入(直接抹去内容,重新写入)
    w新建只写,w+新建读写,二者都会将文件内容清零
예제 #3
0
def func2(a, b):
    if (a > b):
        print(str(a) + "比" + str(b) + "大")
    else:
        print(str(b) + "大于" + str(a) + "或者" + str(b) + "与" + str(a) + "相等")


func2(9, 5)
func2(2, 5)
'''
#模块的导入
#1.网络安装:cmd--pip--- pip install
#2.下载安装(whl):进入lfd python下载,在通过cmd,到相应文件夹,(pip install 文件全名)
#3.直接复制:要python和电脑版本相同才能复制,lib文件夹中

#自定义模块:把python保存到lib目录下

>>> import hello
>>> hello.hello()
hello python
>>> from hello import hello
>>> hello
<function hello at 0x00000188AE01B158>
>>> hello()
hello python
'''
import cgi  #导入cgi模块
cgi.closelog()  #从cgi模块中调用closelog函数
from cgi import closelog  #调用cgi模块中的closelog函数