自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(27)
  • 收藏
  • 关注

原创 2021-04-12 SQL学习笔记

-- 建库CREATE DATABASE 库名;-- 删库DROP DATABASE 库名;-- 建表CREATE TABLE 表名 (列名1, 字段类型 (长度), 列名2, 字段类型 (长度), 列名3, 字段类型 (长度), PRIMARY KEY (列名1));-- 删表DROP TABLE 表名;-- 表增加字段Mysql : ALTER TABLE 表名 ADD COLUMN 列名 字段类型(长度);oracle : ALTER TABLE 表名 A.

2021-04-12 23:11:04 98

原创 card_tools.py

card_list = []# 显示菜单def show_menu(): print('欢迎您使用名片管理系统!') print('=' * 50) print('\n' '1.新增名片\n' '2.显示名片\n' '3.查询名片\n' '\n' '0.退出系统\n...

2018-07-20 08:48:08 318

原创 card_main.py

#! C:\Users\caofeng\AppData\Local\Programs\Python\Python36-32\python.exeimport card_toolswhile True: # TODO 显示系统主菜单 card_tools.show_menu() action = input('请选择您要执行的功能:') print('您选择...

2018-07-19 17:38:55 196

原创 CX_ORACLE连接方法

import cx_Oracleconn = cx_Oracle.connect('yb_ya/***@10.254.254.*:1521/yaybdb',encoding="UTF-8")cursor = conn.cursor()cursor.execute('select * from ac01 where rownum <= 5')result = cursor.fetch...

2018-07-03 11:21:29 5754

转载 Python 常见错误

前言Python 以其简单易懂的语法格式与其它语言形成鲜明对比,初学者遇到最多的问题就是不按照 Python 的规则来写,即便是有编程经验的程序员,也容易按照固有的思维和语法格式来写 Python 代码,之前小编给大家分享过了一篇《Python新手们容易犯的几个错误总结》,但总结的不够全面,最近看到有一个外国小伙总结了一些大家常犯的错误,16 Common Python Runtime Error...

2018-06-26 11:08:39 191

原创 15-5

random_walk.pyfrom random import choiceclass RandomWalk(): def __init__(self,num_points = 5000): self.num_points = num_points self.x_values = [0] self.y_values = [0] ...

2018-06-21 13:47:39 133

原创 15-1 15-2

import matplotlib.pyplot as pltx_values = list(range(1,5000))y_values = [x**3 for x in x_values]plt.scatter(x_values,y_values,c=y_values,cmap=plt.cm.Reds,edgecolors='none',s=40)plt.savefig('squa...

2018-06-21 12:32:41 116

原创 11-3

employee.pyclass Employee(): def __init__(self,firstname,lastname,salary): self.firstname = firstname self.lastname = lastname self.salary = salary def give_raise(sel...

2018-06-20 21:34:04 237

原创 11-2

city_functions.pydef get_city_country(city,country,population=''): if population: city_country = city + ' ' + country + '--' + population else: city_country = city + ' ' + coun...

2018-06-19 16:21:33 107

原创 11-1

def get_city_country(city,country): city_country = city +' ' + country return city_country.title()import unittestfrom city_functions import get_city_countryclass CityCountry(unittest.TestCa...

2018-06-19 16:02:31 282

原创 10-13

import jsondef get_store_username(): filename ='username.json' try: with open(filename) as f_obj: username = json.load(f_obj) except FileNotFoundError: return ...

2018-06-19 14:35:50 125

原创 10-12

import jsondef get_favorite_num(): filename = 'favoritenum.json' try: with open(filename) as f_obj1: favorite_num = json.load(f_obj1) except FileNotFoundError: ...

2018-06-19 10:29:35 115

原创 10-11

import jsonnum = int(input('请输入你最喜欢的数字:'))filename = 'favoritenum.json'with open(filename,'w') as f_obj: json.dump(num,f_obj)with open(filename) as f_obj: favorite_num = f_obj.read() p...

2018-06-19 10:18:22 124

原创 第10章练习1

import jsonfilename = 'silver.txt'filename1 = 'number.json'with open(filename) as f_obj: cont = f_obj.read()with open(filename1,'w') as fl_obj: json.dump(cont,fl_obj) filename = 'numbe...

2018-06-19 10:07:20 95

原创 10-10

filename = 'silver.txt'with open(filename) as fl_obj: cont = fl_obj.read() num1 = cont.count('the') num2 = cont.lower().count('the') print(num1,num2)

2018-06-19 09:52:33 138

原创 10-9

filename1 = 'cats.txt'filename2 = 'dogs.txt'try: with open(filename1) as fl_obj1: contents = fl_obj1.read()except FileNotFoundError: passelse: print(contents)try: with o...

2018-06-19 09:21:32 168

原创 10-8

filename1 = 'cats.txt'filename2 = 'dogs.txt'try: with open(filename1) as fl_obj1: contents = fl_obj1.read()except FileNotFoundError: msg1 = '文件找不到' print(msg1)else: print(...

2018-06-19 09:19:57 148

原创 10-6 10-7

while True: num1 = input('请输入第一个数字(按q退出):') if num1 == 'q': break num2 = input('请输入第二个数字(按q退出):') if num2 == 'q': break try: answer = int(num1) + i...

2018-06-19 09:02:01 270

原创 10-5

while True: msg = input('请输入您喜欢编程的原因(按q退出):') with open('programe.txt','a') as file_object: if msg != 'q': file_object.write(msg + '\n') else: break...

2018-06-18 23:13:17 164

原创 10-3 10-4

filename = 'guest.txt'while True: username = input('Please input you username(q to quit):') with open(filename,'a') as file_object: if username != 'q': file_object.write(...

2018-06-18 23:03:30 176

原创 10-1

filename = 'learning_python.txt'with open(filename) as file_object: contents = file_object.read() print(contents)with open(filename) as file_object: for line in file_object: pr...

2018-06-18 23:02:34 104

原创 9-10

class Restaurant(): def __init__(self, restaurant_name, cuisina_type): self.restaurant_name = restaurant_name self.cuisina_type = cuisina_type self.number_served = 0 ...

2018-06-15 17:19:21 88

原创 9-6

class Restaurant(): def __init__(self,restaurant_name,cuisina_type): self.restaurant_name = restaurant_name self.cuisina_type = cuisina_type self.number_served = 0#餐馆名字...

2018-06-15 16:43:48 134

原创 9-5

class User(): def __init__(self,first_name,last_name,other): self.first_name = first_name self.last_name = last_name self.other = other self.login_attempts = 0 ...

2018-06-15 16:43:24 109

原创 9-3

class User(): def __init__(self,first_name,last_name,other): self.first_name = first_name self.last_name = last_name self.other = other def describe_user(self): ...

2018-06-15 16:42:51 100

原创 9-8

class User(): def __init__(self,first_name,last_name,other): self.first_name = first_name self.last_name = last_name self.other = other self.login_attempts = 0 ...

2018-06-15 16:41:10 93

原创 9-7

class User(): def __init__(self,first_name,last_name,other): self.first_name = first_name self.last_name = last_name self.other = other self.login_attempts = 0 ...

2018-06-15 16:21:12 188

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除