- 博客(15)
- 资源 (3)
- 收藏
- 关注
原创 函数
def a(i): if i == 1: return 1 return a(i-1)+i i = a(100) print(i) def b(i): if i ==1: return 1 if i == 2: return 1 return b(i-1)+b(i-2) print(20)
2020-05-06 20:49:04
97
原创 python 异常处理
''' try: #a = 1 print(a) except: print("") try: print("读文件") f = open('1.txt','r') #读取一个文件 f.read() #阅读 f.write("sdasdd") f.close() #关闭文件释放内存 except: print("") ...
2020-05-05 09:20:37
109
原创 python 函数
#函数 #def aone(): # def 函数名(): # print("aa") # 函数体 # # 调用 #aone() # 函数名() ''' def sum_1_100(m): sun = 0 while i <= m: sun += i...
2020-05-05 09:08:18
109
原创 python 字符串
#字符串 #str1 = "hello,你好加油,hello,世界和平" #print(len(str1)) #长度 #print(str1[6]) #print(str1.index("你")) #查索引 print(str1.index("你",0,100)) 范围 #print(str1.count("l")) #出现次数 #if "你好" in str1: # print(...
2020-05-05 08:37:31
95
原创 python 集合
#集合 去重 list1 = [1,2,3,1,2,3,1,1,2,3,5,4,6,12,3,2,4,2,3,1,2] set1 = set(list1) print(set1)
2020-05-04 13:41:45
99
原创 python 字典
#字典 #dict1 = {"name":"壮士","gander":"男","age":"25"} #print(dict1) #print(dict1["name"]) #dict1 = {"a":"a1","b":"b1","c":"c1"} #dict1["d"] = "d1" #print(dict1) #内存不变 #for i in dict1: # print...
2020-05-04 13:31:53
120
原创 python 内存地址 类型转换
#id() 内存地址 #可变类型 #不可变类型 #list1 = [1,2,3] #tuple1 = (1,2,3) #print(id(list1)) #内存地址 #print(id(tuple1)) #list1.append(4) #print(id(list1)) #内存地址不变 #tuple1 = (1,2,3,4) #print(id(tuple1)) #内存地址改变...
2020-05-04 12:53:54
1226
原创 python 切片 列表推导式
#list1 = [1,2,3,4,5] #for i in list1: #遍历 # print(i) # 将一百以内所有偶数放入一个列表里 #list1 = [] #for i in range(101): # if i % 2 == 0: #取余为0 # list1.append(i) #print(list1) #list1 = [i fo...
2020-05-04 10:27:06
282
原创 python列表用法
python 列表 #list1 = [1,2,3,1,4,1,1,3,3,3] #list2 = [5,6,7,8] #print(list1) #print(list1[0]) #添加合并列表 #list1.append(6) #追加数据到列表最后 #list1.insert(0,9)#添加数据 (索引,数据) #list1.extend(list2)...
2020-05-04 10:00:04
179
原创 python 三角形和乘法表
没有什么区别 只有print()变了 #三角星 ''' #while 循环 i = 1 while i <= 5: j = 1 while j<= i: print('*',end='') j += 1 i += 1 print() #for 循环 i = 1 for i in range(1,6): j = ...
2020-05-04 09:13:48
271
原创 图片爬取
记录 图片爬取 整页 爬的不是4k 4k要会员 import requests #http库 from lxml import etree #数据提取第三方库 url = 'http://pic.netbian.com/4kdongwu/'#地址 count = 1 headers = { 'User-Agent':'Mozilla/5.0 (Windows NT 10.0...
2020-04-30 18:55:15
171
原创 爬取指定网址的短视频(python)
记录,初学 import you_get import sys url = '网址' sys.argv = ['you-get', '-o', '存放视频的目录', url] you_get.main() you_get强大的视频网站下载工具
2020-04-30 14:04:06
482
原创 JavaScript登录窗口的一些代码
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <sc
2018-10-09 18:00:14
515
原创 用JS写的while循环(字体随着变化)
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body > <scrip
2018-10-09 17:51:31
603
原创 ASP.NEP 网页的记住密码
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class da : System.Web.UI.Page { pro...
2018-10-08 19:29:59
296
1
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人