pythpon--类操作
Posted shuimuqingyang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pythpon--类操作相关的知识,希望对你有一定的参考价值。
#coding=utf-8
import numpy as np
import tensorflow as tf
import os
os.environ["CUDA_VISIBLE_DEVICES"]="-1"
# print("aa")
class Animals:
def breathe(self):
print("breathing")
def move(self):
print("moving")
def eat(self):
print("eating food")
class Mammals(Animals):
def breastfeed(self):
print("feed yong")
class Cats(Mammals):
def __init__(self,spots):
self.spots=spots
def catch_mouse(self):
print("cat mouse")
def left_foot_forward(self):
print("left foot forward")
def left_foot_back(self):
print("left foot backward")
def dance(self):
self.left_foot_back()
self.left_foot_forward()
self.left_foot_forward()
self.left_foot_back()
kitty=Cats(10)
print("spots",kitty.spots)
# kitty.dance()
kitty.breastfeed()
以上是关于pythpon--类操作的主要内容,如果未能解决你的问题,请参考以下文章
字符串工具类数组工具类集合工具类转型操作工具类编码与解码操作工具类