随笔分类 -  Python

上一页 1 ··· 4 5 6 7 8 9 下一页
programming language
摘要:python.exe -m pip install --upgrade pip pip install segnopip install qrcode pip install qrcode-artisticpip install urlopenpip install Imagepip install 阅读全文
posted @ 2022-12-17 13:02 ®Geovin Du Dream Park™ 阅读(113) 评论(0) 推荐(0)
摘要:# This is a sample Python script. from os import listdir import csv import numpy import pandas as pd # C:\\Users\\geovindu\\PycharmProjects\\pythonPro 阅读全文
posted @ 2022-11-21 16:17 ®Geovin Du Dream Park™ 阅读(47) 评论(0) 推荐(0)
摘要:GeovinDuMemento.py # 备忘录模式 Memento Pattern GeovinDuMemento.py # class Memento: def __init__(self, value): self.state = value def SetState(self, value) 阅读全文
posted @ 2022-10-27 22:28 ®Geovin Du Dream Park™ 阅读(68) 评论(0) 推荐(0)
摘要:GeovinDuCommand.py # 命令模式 Command Pattern GeovinDuCommand.py # Web Browser: class WebBrowser(object): def __init__(self): self.bookmarks = [] self.cur 阅读全文
posted @ 2022-10-27 22:13 ®Geovin Du Dream Park™ 阅读(27) 评论(0) 推荐(0)
摘要:GeovinDuState.py #状态模式 State Pattern class ComputerState(object): name = "state" allowed = [] def switch(self, state): """ Switch to new state """ if 阅读全文
posted @ 2022-10-26 23:43 ®Geovin Du Dream Park™ 阅读(27) 评论(0) 推荐(0)
摘要:GeovinDuTemplate.py # 模板方法模式 Template Method Pattern def get_text(): return "text 文件" """ method to get the xml version of file""" def get_xml(): retu 阅读全文
posted @ 2022-10-26 22:49 ®Geovin Du Dream Park™ 阅读(22) 评论(0) 推荐(0)
摘要:GeovinDuVisitor.py # 访问者模式 Visitor Pattern GeovinDuVistitor.py class Courses_At_GFG: def accept(self, visitor): visitor.visit(self) def teaching(self, 阅读全文
posted @ 2022-10-25 23:10 ®Geovin Du Dream Park™ 阅读(28) 评论(0) 推荐(0)
摘要:GeovinDuStrategy.py # 策略模式 Strategy Pattern Types of trading strategies: class RiskyTradingStrategy(object): def MakeTrades(self): print("进行高风险交易!") c 阅读全文
posted @ 2022-10-25 21:54 ®Geovin Du Dream Park™ 阅读(35) 评论(0) 推荐(0)
摘要:GeovinDuObserver.py # 观察者模式 Observer Pattern # The Observer class that recieves updates from the ticker on a specific symbol: class TickerObserver(obj 阅读全文
posted @ 2022-10-24 22:05 ®Geovin Du Dream Park™ 阅读(30) 评论(0) 推荐(0)
摘要:DuMediator.py # 中介者模式 Mediator Pattern import sys # ParticipantReference: class User(object): def __init__(self, med, name): self.mediator = med self. 阅读全文
posted @ 2022-10-24 06:42 ®Geovin Du Dream Park™ 阅读(28) 评论(0) 推荐(0)
摘要:DuIterator.py # 迭代器模式 Iterator Pattern # Doubly Linked List class Node(object): def __init__(self, value, nextNode, prevNode): self.value = value self 阅读全文
posted @ 2022-10-23 23:49 ®Geovin Du Dream Park™ 阅读(31) 评论(0) 推荐(0)
摘要:DuChain.py # 责任链模式 Chain of Responsibility import enum # Item Types: # An enum we'll attach to every game object to specify type: # Requires Python 3. 阅读全文
posted @ 2022-10-23 08:22 ®Geovin Du Dream Park™ 阅读(39) 评论(0) 推荐(0)
摘要:DuProxy.py # 代理模式 Proxy Pattern from abc import ABCMeta, abstractmethod import abc import random class ISubject(metaclass=ABCMeta): "An interface impl 阅读全文
posted @ 2022-10-22 23:14 ®Geovin Du Dream Park™ 阅读(18) 评论(0) 推荐(0)
摘要:DuFlyweight.py # 享元模式 Flyweight Pattern geovindu,Geovin Du,涂聚文 import time class Arrow: def __init__(self, x, y, z, velocity): self.x = x self.y = y s 阅读全文
posted @ 2022-10-22 11:32 ®Geovin Du Dream Park™ 阅读(25) 评论(0) 推荐(0)
摘要:DuFacade.py import os import re import threading # 外观模式 Facade Pattern class _IgnitionSystem(object): @staticmethod def produce_spark(): return True c 阅读全文
posted @ 2022-10-22 07:07 ®Geovin Du Dream Park™ 阅读(26) 评论(0) 推荐(0)
摘要:DuDecorator.py # 装饰模式 Decorator Pattern import six # https://pypi.org/project/six/ from abc import ABCMeta @six.add_metaclass(ABCMeta) class Abstract_ 阅读全文
posted @ 2022-10-21 22:40 ®Geovin Du Dream Park™ 阅读(11) 评论(0) 推荐(0)
摘要:DuComposite.py # 组合模式 Composite Pattern from __future__ import annotations from abc import ABC, abstractmethod from typing import List class Component 阅读全文
posted @ 2022-10-21 22:21 ®Geovin Du Dream Park™ 阅读(24) 评论(0) 推荐(0)
摘要:DuSingleton.py import httplib2 # https://pypi.org/project/httplib2/ import os import re import threading import urllib import urllib.request from urll 阅读全文
posted @ 2022-10-20 22:42 ®Geovin Du Dream Park™ 阅读(25) 评论(0) 推荐(0)
摘要:DuPrototype.py import copy ## 原型模式 Prototype Pattern DuPrototype。py class SelfReferencingEntity: def __init__(self): self.parent = None def set_parent 阅读全文
posted @ 2022-10-20 21:50 ®Geovin Du Dream Park™ 阅读(35) 评论(0) 推荐(0)
摘要:DuBridge.py # 桥接模式 Bridge Pattern # DuBridyge.py editor: geovindu, Geovin Du from __future__ import annotations from abc import ABC, abstractmethod cl 阅读全文
posted @ 2022-10-19 22:30 ®Geovin Du Dream Park™ 阅读(42) 评论(0) 推荐(0)

上一页 1 ··· 4 5 6 7 8 9 下一页