- 博客(12)
- 收藏
- 关注
原创 task6
def temp(x): "这里是帮助文档" print(x)help(temp)Help on function temp in module __main__:temp(x) 这里是帮助文档 a = [[6, 5], [3, 7], [2, 8]]endnum = lambda x: x[1]a.sort(key= endnum)print(a)[[6, 5], [3, 7], [2, 8]] a = [[6, 5], [3, 7], [2, 8]]
2020-08-02 20:52:47 140
原创 task5
dic = {'python': 95,'java': 99, 'c':100}len(dic)3dic['java'] = 98print(dic){'python': 95, 'java': 98, 'c': 100}dic.pop('c')print(dic){'python': 95, 'java': 98}dic['php'] = 90print(dic){'python': 95, 'java': 98, 'php': 90}lst = list(dic
2020-07-31 21:01:15 166 1
原创 task4
list1 = [2,5,6,7,8,9,2,9,9]list1.append(15)print(list1)[2, 5, 6, 7, 8, 9, 2, 9, 9, 15]list1.insert(5,20)print(list1)[2, 5, 6, 7, 8, 20, 9, 2, 9, 9, 15]list2 = [2,5,6]list1.extend(list2)print(list1)[2, 5, 6, 7, 8, 20, 9, 2, 9, 9, 15, 2, 5, 6
2020-07-28 22:04:00 154
原创 task3
import randomx = random.randint(0,100)print(x)while True: y = input('大爷来猜呀') try: y_int =int(y) except ValueError: print('输入无效') else: if y_int==x: print('恭喜你猜到了这个数是'+str(x)) break
2020-07-25 15:50:05 110
原创 task2
for i in range(1500,2700): if i % 35 == 0: print(i,end = ' ') 1505 1540 1575 1610 1645 1680 1715 1750 1785 1820 1855 1890 1925 1960 1995 2030 2065 2100 2135 2170 2205 2240 2275 2310 2345 2380 2415 2450 2485 2520 2555 2590 2625 2660 26
2020-07-23 22:22:02 73
原创 datawhale python 第一课 练习题
1、使用#进行单行的注释,使用''' ''' 或""" """进行 多行的注释;2、 2.1 数字运算符:+ -* / ;** // % 2.2位运算符 & | ~ ^ >> << 2.3 比较运算符 > >= < <= == != 2.4 逻辑运算符 and or not 2.5 三元运算符 x = 1 if 2>1 else 2 运算优先级由...
2020-07-22 20:10:32 133
原创 爬虫_task3
# 案例代码from bs4 import BeautifulSoupimport requestsimport timedef open_proxy_url(url): user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chro...
2020-04-25 23:37:31 14926
原创 爬虫_2
最近工作的事情比较多,只是简单的把程序看了一遍,周六再尝试一下其他购物网站的爬取。from bs4 import BeautifulSoupimport requests # 抓取页面r = requests.get('https://python123.io/ws/demo.html') # Demo网址demo = r.text # 抓取的数据demo'<html>...
2020-04-23 23:19:27 2320
原创 pandas2
import numpy as npimport pandas as pddf = pd.read_csv(r"C:\SAIC\DataHunter\GitHub\joyful-pandas\data\table.csv",index_col='ID')df.head() School Class Gender ...
2020-04-23 21:23:17 130
原创 pandas_2
import numpy as npimport pandas as pddf = pd.read_csv(r"C:\SAIC\DataHunter\GitHub\joyful-pandas\data\table.csv",index_col='ID')df.head() School Class Gender ...
2020-04-21 22:50:59 116
原创 爬虫_1
import requestsurl = 'https://www.python.org/dev/peps/pep-0020/'res = requests.get(url)text = res.texttext'<!doctype html>\n<!--[if lt IE 7]> <html class="no-js ie6 lt-ie7 lt-ie...
2020-04-21 21:52:44 5441
原创 pandas (1)
import pandas as pdimport numpy as nppd.__version__'1.0.3'df = pd.read_csv('C:/SAIC/DataHunter/GitHub/joyful-pandas/data/table.csv')df.head() School Class ...
2020-04-20 22:09:45 288
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人