class BookInfoManager(models.Manager):
"""图书模型管理器类"""
# 1.改变查询的结果集
def all(self):
# 1.调用父类的all,获取所有数据
books = super().all()
# 2.对数据进行过滤
books = books.filter(isDelete=False)
# 3.返回books
return books
# 2.封装函数:操作模型类对应的数据表(增删改查)
......................
阅读全部
|
fightingboys
贴于 2019年9月17日 10:31
hide
bbsi
#######################################################################
# Copyright (C) #
# 2016-2018 Shangtong Zhang(zhangshangtong.cpp@gmail.com) #
# 2016 Kenta Shimada(hyperkentakun@gmail.com) #
# Permission given to modify the code as long as you keep this #
# declaration at the top #
#######################################################################
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
......................
阅读全部
|
ssrww000
贴于 2019年9月5日 19:51
hide
bbsi
import requests
import json
list1=['day','week','wea','tem','tem1','tem2','win','win_speed','air_level','air_tips'] list2=['','','天气: ','温度: ','最高温度: ','最低温度: ','风向: ','风速: ','空气质量: ','建议: ']
def show(days):
for i in range(10):
r=str(list2[i])+str(days[list1[i]])
print(r)
def show2(days):
......................
阅读全部
|
fighting910
贴于 2019年7月25日 19:15
hide
bbsi
import urllib2
f=urllib2.urlopen(raw_input("Please enter the URL:"))
ff=open(raw_input("Please enter the filename:"),"w+")
for x in range(1,1000):
s=f.read()
ff.write(s)
ff.close()
阅读全部
|
cstdio
贴于 2019年4月4日 17:59
hide
bbsi
import urllib2
f=urllib2.urlopen(raw_input("Please enter the URL:"))
s=f.read()
ff=open(raw_input("Please enter the filename:"),"w+")
ff.write(s)
ff.close()
阅读全部
|
cstdio
贴于 2019年2月28日 17:53
hide
bbsi
#coding=utf-8
from __future__ import print_function
#利用泰勒公式计算星期几
#w=y+[y/4]+[c/4]-2c+[26(m+1)/10]+d-1
def getweek(year,month,day):
#w #星期
#c #世纪-1 YYYY的头两位
#y #年份 YYYY的后两位
#m #月份 >=3 1月 2月看成上年的13月 14月
#d=day #日
if month>=3:
......................
阅读全部
|
wp231957
贴于 2019年2月27日 15:05
hide
bbsi
from __future__ import print_function
import socket
import sys
import os
filename=sys.argv[1]
txt=open(filename,"rb+")
filesize=os.path.getsize(filename)
i=1
while i<=filesize:
data=txt.read(1)
print ("%4s"%str(hex(ord(data)))+' ',end='')
......................
阅读全部
|
wp231957
贴于 2019年2月26日 14:00
hide
bbsi
import urllib2
f=urllib2.open(raw_input("Please enter the URL:"))
s=f.read()
ff=open(raw_input("Please enter the filename:"),"w+")
ff.write(s)
ff.close()
阅读全部
|
cstdio
贴于 2019年2月14日 11:56
hide
bbsi
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import sys
import time
def get_remote_status():
l = os.popen('ssh root@remote.com "cd /var/www/mysite; git st"').readlines()
s = ''.join(l)
return s
......................
阅读全部
|
静夜思
贴于 2018年9月11日 10:29
hide
bbsi