腾讯云
开发者社区
文档
建议反馈
控制台
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
登录/注册
首页
学习
活动
专区
工具
TVP
最新优惠活动
返回腾讯云官网
玩转编程
一起玩转编程
专栏作者
举报
41
文章
12895
阅读量
15
订阅数
订阅专栏
申请加入专栏
全部文章
python
app
beautifulsoup
time
c++
actionscript
r 语言
html
json
sqlite
github
linux
mongodb
爬虫
ssh
numpy
selenium
tcp/ip
scrapy
browser
calculator
calendar
compare
data
datetime
dump
error
exception
filter
final
function
input
insert
join
list
load
lxml
math
mysql
output
pickle
queue
range
redis
scope
settings
statistics
table
target
thread
threadpool
threadpoolexecutor
version
wait
搜索文章
搜索
搜索
关闭
Python 系列文章 —— numpy 详解
numpy
numpy from numpy import * import numpy as np # numpy 简单运用实例 print(eye(4)) # 创建简单的 ndarray 对象 a = np.array([1, 2, 3]) print(a) # 创建大于 1 维的数组 使用 ndmin 参数,ndmin 参数默认值为0 b = np.array([1, 2, 3], ndmin=2) print(b) b1 = np.array([2, 3, 4],ndmin=-1) print(b1)
玩转编程
2022-01-15
216
0
Python 系列文章 —— Python 操作 MySQL 详解
data
insert
mysql
table
create_table import pymysql # 打开数据库连接 conn = pymysql.connect( host="127.0.0.1", user="root", password="123456", database="test_db", charset="utf8") # 获取连接下的游标 cursor_test = conn.cursor() # 使用 execute() 方法执行 SQL,如果表存在则删除 cursor_test.e
玩转编程
2022-01-15
192
0
Python 系列文章 —— Python 操作 mongodb 详解
mongodb
mongodb #导入 MongoClient 模块 from pymongo import MongoClient, ASCENDING, DESCENDING # 两种方式 #1. 传入数据库IP和端口号 mc = MongoClient('127.0.0.1', 27017) #2. 直接传入连接字串 mc = MongoClient('mongodb://127.0.0.1:27017') # 有密码的连接 # 首先指定连接testdb数据库 # db = mc.testdb # 通过aut
玩转编程
2022-01-15
249
0
Python 系列文章 —— sqlite 详解
sqlite
sqlite_demo 导入模块 mport sqlite3 连接数据库 onn = sqlite3.connect('test.db') 创建游标 s = conn.cursor() 创建表 cs.execute('''CREATE TABLE student (id varchar(20) PRIMARY KEY, name varchar(20));''') 关闭 Cursor cs.close() 提交 conn.commit() 关闭连接
玩转编程
2022-01-15
236
0
Python 系列文章 —— renren 实战
github
github import scrapy import re class GithubSpider(scrapy.Spider): name = 'github' allowed_domains = ['github.com'] # 登录页面 URL start_urls = ['https://github.com/login'] def parse(self, response): # 获取请求参数 commit = respo
玩转编程
2022-01-15
328
0
Python 系列文章 —— WxCrawler
python
WxCrawler # coding:utf-8 import requests import re import html import demjson import json from bs4 import BeautifulSoup import urllib3 class WxCrawler(object): urllib3.disable_warnings() #Hearders,x-wechat-key 会过期,会出验证问题 headers = """Connect
玩转编程
2022-01-15
232
0
Python 系列文章 —— Python redis 详解
redis
redis import redis #导入redis模块 # 建议使用以下连接池的方式 # 设置decode_responses=True,写入的KV对中的V为string类型,不加则写入的为字节类型。 pool = redis.ConnectionPool(host='127.0.0.1', port=6379, db=0, decode_responses=True) rs = redis.Redis(connection_pool=pool) # key="color",value="red
玩转编程
2022-01-15
316
0
Python 系列文章 —— 新闻抓取
python
demo import newspaper # 词频统计库 import collections # numpy库 import numpy as np # 结巴分词 import jieba # 词云展示库 import wordcloud # 图像处理库 from PIL import Image # 图像展示库 import matplotlib.pyplot as plt # 获取文章 article = newspaper.Article('https://news.sina.com.cn/o/
玩转编程
2022-01-15
590
0
Python 系列文章 —— crawlerdb
python
crawlerdb import mysql.connector import pymysql from pyspider.result import ResultWorker class crawlerdb: conn = None cursor = None def __init__(self): self.conn = pymysql.connect("127.0.0.1", "root", "12345678", "crawler")
玩转编程
2022-01-15
168
0
Python 系列文章 —— FBP_Scrapy 项目实战
scrapy
FBP_Scrapy import datetime import sys import requests import scrapy import time import json import s
玩转编程
2022-01-15
203
0
Python 系列文章 —— itemcsvexporter
settings
itemcsvexporter from scrapy.conf import settings # from scrapy.contrib.exporter import CsvItemExporter from scrapy.exporters import CsvItemExporter #指定输出到csv文件中字段的顺序,结合setting.py class itemcsvexporter(CsvItemExporter): def __init__(self, *args, **kwarg
玩转编程
2022-01-15
243
0
Python 系列文章 —— selenium 详解
selenium
browser
wait
selenium-browser-back-forward from selenium import webdriver import time # 声明浏览器对象 driver = webdriver.Chrome() # 访问百度 driver.get("http://www.baidu.com") time.sleep(2) # 访问微博 driver.get("https://weibo.com") time.sleep(2) # 访问知乎 driver.get("http://www.zhihu
玩转编程
2022-01-15
314
0
Python 系列文章 —— BeautifulSoup 实战
beautifulsoup
BeautifulSoup 实战 from bs4 import BeautifulSoup html_doc = """ <html><head><title>index</title></head> <body> <p class="title"><b>首页</b></p> <p class="main">我常用的网站 <a href="https://www.google.com" class="website" id="google">Google</a> <a href="https://www
玩转编程
2022-01-15
239
0
Python 系列文章 —— BeautifulSoup 详解
beautifulsoup
BeautifulSoup.py from bs4 import BeautifulSoup # demo 1 # soup = BeautifulSoup(open("index.html")) soup = BeautifulSoup("<html><head><title>index</title></head><body>content</body></html>", "lxml") print(soup.head) html_doc = """ <html><head><title>inde
玩转编程
2022-01-15
219
0
Python 系列文章 —— lxml 详解
lxml
lxml.py from lxml import etree from io import StringIO test_html = ''' <html> <body> <div> <!-- 这里是注释 --> <h4>手机品牌商<span style="margin-left:10px">4</span></h4> <ul> <li>小米</li>
玩转编程
2022-01-13
317
0
Python 系列文章 —— flask 表单案例
html
app
app.py from flask import Flask, render_template, redirect, url_for, request from flask_wtf import FlaskForm from wtforms import StringField, PasswordField from wtforms.validators import DataRequired, EqualTo from werkzeug.security import generate_passwor
玩转编程
2022-01-13
526
0
Python 系列文章 —— 爬虫小案例
python
爬虫
Example_Request # 采用 HTTP GET 请求的方法模拟谷歌浏览器访问网站,输出响应上下文 from urllib import request,parse url = 'http://www.python.org' headers = { 'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/
玩转编程
2022-01-13
244
0
Python 系列文章 —— trafficLight
python
trafficLight import threading import time event = threading.Event() def drive(name): i = 0 while True: i = i + 1 print(name + "正在行驶中,行驶了" + str(i * 60) + "Km") time.sleep(1) event.wait() print(name + "通过了红
玩转编程
2022-01-13
169
0
Python 系列文章 —— 线程池
threadpool
threadpoolexecutor
threadpool-demo import time import threadpool import threading def sayhello(name): print("%s say Hello to %s" % (threading.current_thread().getName(), name)); time.sleep(1) return name def callback(request, result): # 回调函数,用于取回结果 print("c
玩转编程
2022-01-13
187
0
Python 系列文章 —— queue
compare
function
queue
queue_common_function_demo import queue q = queue.Queue() q.put(100) q.put(200) q.qsize() # 获取队列大小,此处结果为 2 import queue q = queue.Queue(maxsize=1) q.empty() # 判断队列是否空,此处结果为 True q.full() # 判断队列是否满,此处结果为 False q.put(100) q.empty() # False q.full() # True
玩转编程
2022-01-13
258
0
点击加载更多
社区活动
腾讯技术创作狂欢月
“码”上创作 21 天,分 10000 元奖品池!
立即发文
Python精品学习库
代码在线跑,知识轻松学
立即查看
博客搬家 | 分享价值百万资源包
自行/邀约他人一键搬运博客,速成社区影响力并领取好礼
立即体验
技术创作特训营·精选知识专栏
往期视频·千货材料·成员作品 最新动态
立即查看
领券
问题归档
专栏文章
快讯文章归档
关键词归档
开发者手册归档
开发者手册 Section 归档