摘要:
__author__ = "Alex Li" import shelve import datetime d = shelve.open('shelve_test') # 打开一个文件 info = {'age':22,"job":'it'} name = ["alex", "rain", "tes 阅读全文
摘要:
__author__ = "Alex Li" import shutil f1 = open("本节笔记",encoding="utf-8") f2 = open("笔记2","w",encoding="utf-8") shutil.copyfileobj(f1,f2) shutil.copyfil 阅读全文
摘要:
__author__ = "Alex Li" import package_test #run __init__.py import os import sys print(sys.argv) package_test.test1.test() #目录导入,经过__init__.py 目录结构 ./ 阅读全文
摘要:
xml创建.py __author__ = "Alex Li" import xml.etree.ElementTree as ET new_xml = ET.Element("personinfolist") personinfo = ET.SubElement(new_xml, "personi 阅读全文
摘要:
__author__ = "Alex Li" import configparser #ConfigParser config = configparser.ConfigParser() config["DEFAULT"] = {'ServerAliveInterval': '45', 'Compr 阅读全文
摘要:
随机数 #!/usr/bin/env python # encoding: utf-8 import random import string #随机整数: print( random.randint(0,99)) #70 #随机选取0到100间的偶数: print(random.randrange 阅读全文
摘要:
0.在当前目录新建一个module_alex.py __author__ = "Alex Li" name='alex' def say_hello(): print('hello alex') def logger(): print('in the module alex') def runnin 阅读全文
摘要:
__author__ = "Alex Li" ''' names = ['alex','jack'] data = {} # data['name'] # names[3] # 报错内容 # Traceback (most recent call last): # File "E:/python S 阅读全文
摘要:
__author__ = "Alex Li" import os # os.system() # os.mkdir() class Dog(object): '''这个类是描述狗这个对象的''' def __init__(self,name): self.name = name self.__foo 阅读全文
摘要:
__author__ = "Alex Li" class MyType(type): def __init__(self, what, bases=None, dict=None): print("--MyType init ") super(MyType, self).__init__(what, 阅读全文