码迷,mamicode.com
首页 > 其他好文 > 详细

pythpon--类操作

时间:2019-06-17 20:18:50      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:coding   imp   The   forward   ble   utf-8   visible   als   cuda   

#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--类操作

标签:coding   imp   The   forward   ble   utf-8   visible   als   cuda   

原文地址:https://www.cnblogs.com/shuimuqingyang/p/11041875.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!