![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python有始有终
xi_xi_wo
这个作者很懒,什么都没留下…
展开
-
python日常函数集合
# 检验是否含有中文字符def is_contains_chinese(strs): for _char in strs: if '\u4e00' <= _char <= '\u9fa5': return True return False#首字母大写def firstUp(title): new_str = '{}{}'.format(title[0].upper(), title[1:]) return new_原创 2021-09-28 10:32:33 · 71 阅读 · 0 评论 -
python 日期显示
# 02 August 2021today = time.strftime("%d %B %Y", time.localtime())# 2021.06.10time.strftime("%Y.%m.%d ")# 13 Aug 21time.strftime("%d %b %y", time.localtime())原创 2021-08-13 10:58:02 · 112 阅读 · 0 评论 -
关于python 小数点取整
import matha = 3.1int(a) == 3round(a) == 3math.ceil(a) == 4b = 3.8int(b) == 3round(b) == 4math.ceil(b) == 4原创 2021-07-05 16:46:10 · 191 阅读 · 0 评论 -
range的作用
for i in range(5): print("i=",i)运行结果i= 0i= 1i= 2i= 3i= 4for i in range(0,5,2): print("i=",i)运行结果i= 0i= 2i= 4'''总结:range(0,5,2)从0开始到5结束,中间每个数的间隔为2'''...原创 2019-12-30 16:44:34 · 728 阅读 · 0 评论 -
python 字符串操作
name = "chuanpu" '''英文首字母大写''' print(name.capitalize()) '''字符串中a出现次数''' print(name.count("a")) '''7为总长度,字符串长度不足7用*补,字符串左右平分,先左后右''' print(name.center(7,"*")) '''判断字符串结尾是不是x...原创 2020-01-06 16:35:05 · 79 阅读 · 0 评论 -
初识python集合
a_list = [1,2,3,4]a_list = set(a_list)b_list = set([3,4,5,6])c_list = set([1,2])'''交集 ,取相同的元素'''print(a_list.intersection(b_list))print("简写交集",a_list & b_list)'''并集 所有元素只出现一次'''print...原创 2020-01-13 11:32:35 · 153 阅读 · 0 评论 -
because its MIME type (‘application/x-js‘) is not executable, and strict MIME type checking is enab
导入Django项目运行程序,其中一个页面报如下错误(index):1 Refused to execute script from ‘http://xxxxxx/js/keyword_h.js’ because its MIME type (‘application/x-js’) is not executable, and strict MIME type checking is enabled.因为其MIME类型(“application/x-js”)不可执行,并且启用了严格的MIME类型检查.原创 2020-07-23 10:43:36 · 2167 阅读 · 3 评论 -
简单的python冒泡排序
def test_2(): temp = 0 array = [7,3,9,8,2] for i in range(len(array)): for j in range(len(array)-1):#len(array)-1这里不-1下面的判断就报错了,下标溢出 if array[j] > array[j+1]: ...原创 2020-04-30 09:30:03 · 95 阅读 · 0 评论