摘要: 写到后面有点恶心,python这个语言还是很不适应 就不挨个贴代码了,有兴趣的可以下载看一下 下载 https://files.cnblogs.com/files/beastGentleman/t13.zip 阅读全文
posted @ 2021-04-21 10:31 野兽Gentleman 阅读(46) 评论(0) 推荐(0)
摘要: set global time_zone = '+8:00'; flush privileges; 治标不治本 稍后研究 阅读全文
posted @ 2021-04-19 08:53 野兽Gentleman 阅读(49) 评论(0) 推荐(0)
摘要: 我是python版本3.8.8 不是python3的话自己去找一下python的安装语句pip3 install matplotlib 安装命令切记多试几次! pip3 install matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple如果上 阅读全文
posted @ 2021-04-17 14:00 野兽Gentleman 阅读(92) 评论(0) 推荐(0)
摘要: import sys import pygame from settings import Settings from ship import Ship from bullet import Bullet class AlienInvasion: "管理游戏资源和行为的类" def __init__ 阅读全文
posted @ 2021-04-17 13:23 野兽Gentleman 阅读(81) 评论(0) 推荐(0)
摘要: filename = 'pi_digits.txt' with open(filename) as file_object: lines = file_object.readlines() for line in lines: print(line.rstrip()) open() 接受的参数是当前 阅读全文
posted @ 2021-04-11 16:14 野兽Gentleman 阅读(90) 评论(0) 推荐(0)
摘要: class Dog: """A simple attempt to model a dog.""" def __init__(self, name, age): """Initialize name and age attributes.""" self.name = name self.age = 阅读全文
posted @ 2021-04-11 15:35 野兽Gentleman 阅读(58) 评论(0) 推荐(0)
摘要: def getUser(): def关键字定义了一个函数 关键字实参 def getUser(userName, userAge): getUser(userName='张三', userAge=18) 默认值 def getUser(userName, userAge=18): 如果没有传年龄过来 阅读全文
posted @ 2021-04-11 14:56 野兽Gentleman 阅读(151) 评论(0) 推荐(0)
摘要: input() 可以添加参数显示在控制台 然后获得输入的字符串 int()获得输入的数字 求模运算 4%3 -- 15%3 -- 2 6%3 -- 0 阅读全文
posted @ 2021-04-11 14:19 野兽Gentleman 阅读(52) 评论(0) 推荐(0)
摘要: 字典 alien_0 = {'x_position': 0, 'y_position': 25, 'speed': 'medium'} print(f"Original position: {alien_0['x_position']}") Original position: 0 字典是键值对 感 阅读全文
posted @ 2021-04-11 14:08 野兽Gentleman 阅读(73) 评论(0) 推荐(0)
摘要: cars = ['audi', 'bmw', 'subaru', 'toyota'] for car in cars: if car == 'bmw': print(car.upper()) else: print(car.title()) if语句 得到的值是Treu 或者 False 注意首字母 阅读全文
posted @ 2021-04-11 13:35 野兽Gentleman 阅读(50) 评论(0) 推荐(0)