一.PyCharm 设置作者信息模板 1.File---Settings---在搜索框中搜索:File and Code Templates---Python scripts #!/usr/bin/env python # -*- coding:utf-8 -*- #Author: nulige 二.修改解释器方法 File---settings---project:python---project interpreter 三.设置软件UTF-8 编码File---Settings----搜索框…
设置头部信息路径: 打开File—Settings—Editor—File and Code Templates—Python Script 输入要自动生成的头部信息模板 这样,新建py文件就会自动生成头部信息 参考设置: # coding: utf-8 # Team : Quality Management Center # Author:Carson # Date :$DATE $TIME # Tool :$PRODUCT_NAME…
  #!/usr/bin/env python # -*- coding:utf-8 -*- 日志 import logging # 5个级别的日志 DEBUG INFO WARNING ERROR CRITICAL """logging.warning("1111111") #输出日志信息到屏幕 logging.critical("2222222")""" logging.basicConfig(file…
一.背景:当使用git提交代码时,每次的提交信息固定,却又比较长不好记的时,还需要将模板的地址保存下来,如果能设置一个固定的模板就可以很好的解决这个问题. 提交前的提交信息需要手动输入: 二.ToroiseGit实施方案: 1.右键菜单 - TortoiseGit - Settings   2.Git - Edit global.gitconfig  3. 编辑全局git配置,并添加[commit]配置,设置模板指向本地的路径 [commit] template=D:\\tools\\commi…
在工作中经常会需要确定使用的py的版本信息,以便适配更多的系统,达到更大的兼容性. 一般关于python的信息和参数都要调用sys模块,关于操作系统的信息和调用都要使用os模块 所以这次我们使用sys模块 import sys sys.version #获取python版本等信息   PS:dir(sys)可获取sys所有接口 第二种方法是在linux命令行下键入:python,然后就会进入python,并显示相关信息,结果如图:…
# 魔术方法--常规方法# 1. __int__ 构造函数# 2. __new__ 在类实例之前就创建了# 3. __iter__ 迭代器# 4. __del__ 析构方法,用来清除释放的对象内存# 5. __class__ 魔术属性,返回所有的类--元类# 6. __str__ 返回类+属性# 7. __repr__ 返回类+属性,与__str__类似# 8. __dict__ 返回类属性和对应的属性值,存储在字典中# 9. dir() 返回当前类的属性和python内置属性,但不显示当前类属…
#!/usr/bin/env python # -*- coding:utf-8 -*-网络爬虫代理 import urllib.request import random url="http://www.whatismyip.com.tw" #使用单个IP proxy_support = urllib.request.ProxyHandler({'http':'218.249.198.30:3128'}) #使用个IP 列表 iplist=['114.113.220.99:99999…
import types print(type('abc') == str)#True print(type(123) == int)#True def f1(): pass print(type(f1) == types.FunctionType)#True print(type(abs) == types.BuiltinFunctionType)#True print(type(lambda x:x) == types.LambdaType)#True print(type(x for x…
window—>preferences—>Java—>Code Stype—>Code Templates Code—>New Java files 点击Edit ${filecomment} ${package_declaration} /** * @author GK * @version 创建时间:${date} ${time} * @ClassName 类名称 * @Description 类描述 */ ${typecomment} ${type_declaratio…
一.函数的嵌套 嵌套在外层,称之为外函数 嵌套在里层,称之为内函数#例:def outer(): def inner():        print("I'm inner")    def inn2():        print("12345")    inn2()    inner()outer() #inner() (1)内部函数可以直接在函数外部调用吗 不可以(2)调用外部函数后,内部函数可以在函数外部调用吗 不可以(3)内部函数可以在函数内部调用吗  可以…