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