Quantcast
Channel: CodeSection,代码区,Python开发技术文章_教程 - CodeSec
Browsing all 9596 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

How Many Trials Before the Nth Success

TLDR: the negative binomial counts the number of trials needed before the Nth success. I had this problem where we were considering running some very expensive tests that had a known success rate, and...

View Article


python toolbox

python有很多非常棒的工具,pip应该是最最常用,也是最最基本,在pytoon的地位 就如同debian系的apt, CentOS的yum以及OSX的brew。 Python有个挺讨厌的地方就是项目的依赖包,Ruby有个Bundler利用Gemfile解决了这个问题 Python的pip也具备类似的功能(不过感觉没npm以及Bundler好用)。 pip freeze >...

View Article


select sort

闲着没事,就想起写写排序的算法,因为从来没用python写过算法,依据算法的原理很快 就撸了个选择排序: def select_sort(ary): for i in range(len(ary)): tmp = ary[i] index = ary.index(min(ary[i:])) ary[i] = ary[index] ary[index] = tmp return ary...

View Article

WeRoBot 1.0.0 , Python 的微信公众号开发框架

WeRoBot 1.0.0 发布了。 WeRoBot 1.0.0 中对之前的一部分代码进行了重构,并加入了许多新的功能,修复了大量 bug。具体更新如下: 增加对消息加解密的支持 重写 werobot.messages, 完善对 Event 的支持 将微信消息的id属性重命名为message_id 增加 werobot.reply.SuccessReply 增加...

View Article

Python note

字符串的负索引访问,其实可以这么看,就是访问字符串长度加上负数 索引得到的index所指向的字符 例如如果line这个字符串是’hello pyclear’,那么下面两行的执行结果是一样的 line[-1:] line[len(line) + (-1):len(line)]` 嵌套+列表解析的好用 [{'title: i[0],'url': i[1]} for i in data] 原始字符串...

View Article


Image may be NSFW.
Clik here to view.

网络科学 | 用Python侦测比特币交易的网络可视化分析

网络科学 | 用python侦测比特币交易的网络可视化分析 一点号沈浩11小时前 今天给大家介绍如何用网络科学的大数据挖掘技术探索比特币交易的网络情况,特别是针对尺度较大的网络分析思路。...

View Article

Image may be NSFW.
Clik here to view.

Flask-admin使用经验技巧总结

笔者是看狗书入门的flask,狗书上对于flask-admin这个扩展并没有进行讲解,最近因为项目需要,学习使用flask-admin,瞬间体会到了flask开发的快速、扩展的强大 Flask-admin 使用经验技巧总结   from flask_admin import Admin,BaseView,expose,AdminIndexView   from...

View Article

Image may be NSFW.
Clik here to view.

Getting started with mini projects in Python: Tweet Bot

So everyone around has been telling you that Computer Programming is super awesome. Once you learn it, you can code your own websites, Android apps, games and what not. So one day you get fed up with...

View Article


Image may be NSFW.
Clik here to view.

Python Data: Dask A better way to work with large CSV files in Python

In a recent post titled Working with Large CSV files in python , I shared an approach I use when I have very large CSV files (and other file types) that are too large to load into memory. While the...

View Article


使用Python连接PostgreSQL

python中可以用来连接PostgreSQL的模块很多,这里比较推荐psycopg2。psycopg2安装起来非常的简单(pip install psycopg2),这里主要重点介绍下如何使用。 连接数据库: importpsycopg2 conn =...

View Article

Image may be NSFW.
Clik here to view.

信息安全-1:python之playfair密码算法详解

信息安全-1:python之playfair密码算法详解 6小时前来源:cnblogs 一、基本概念 古典密码是基于字符替换的密码。加密技术有:Caesar(恺撒)密码、Vigenere(维吉尼尔)密码、Playfair密码、Hill密码…… 明文:未经过加密的信息;密文:加密后的信息 加密解密的过程:如下图 php?url=0F32COnbRA"...

View Article

Image may be NSFW.
Clik here to view.

Python 解决编码问题: `UnicodeEncodeError: 'Gbk' Codec Can't Encode Character '' ...

目标网站: http://blog.csdn.net/ def process_item(self, item, spider): # print(item['title']) for i in range(0, len(item['title'])): print('第' + str(i+1) + '篇文章:') print(item['title'][i])...

View Article

Image may be NSFW.
Clik here to view.

最全的Python开发套件来了!Python开发一“包”打尽~

TPYBoard推出的159元的超值17件大礼包套餐,得到了广大Geeker的支持和喜爱,为回馈广大的python爱好者以及让更多的计算机爱好者体验python开发的魅力,TPYBoard不忘初心、感恩前行,现推出一款 199元 Python超值套件,内含TPYBoard开发板、LCD1602、DS3231、直流电机、步进电机、ST―Link仿真器等 24件 超值元器件套餐。 该套餐...

View Article


Image may be NSFW.
Clik here to view.

Whatsapp using Python!

Have you ever wished to automatically wish your friends on their birthdays, or send a set of messages to your friend ( or any Whastapp contact! ) automatically at a pre-set time, or send your friends...

View Article

Image may be NSFW.
Clik here to view.

Django初识

web框架 Web应用框架有助于减轻网页开发时共通性活动的工作负荷,例如许多框架提供数据库访问接口、标准样板以及会话管理等,可提升代码的可再用性。简单地说,就是你用别人搭建好的舞台来做表演,用别人做好的模板进行功能扩展。python的web应用框架主要有django,Tornado。 MVC模式和MTV模式 MVC全名是Model View...

View Article


Image may be NSFW.
Clik here to view.

Archey X

There’s a new version of my Archey, and I have also re-named my “Archey :: OS X” to “ Archey X ”.The new version is no longer an OS X- only version ― it’s been updated to be X compatible with both OS...

View Article

Python --- Xpath 表达式 --- Ongoing

什么是XPath? 参考网站: http://www.w3school.com.cn/xpath/xpath_intro.asp XPath 是一门在 XML 文档中查找信息的语言。XPath 用于在 XML 文档中通过元素和属性进行导航。 xpath 表达式 语法讲解 参考网站: http://www.w3school.com.cn/xpath/xpath_syntax.asp...

View Article


使用Python从Markdown文档中自动生成标题导航

概述 Markdown 很适合于技术写作,因为技术写作并不需要花哨的排版和内容, 只要内容生动而严谨,文笔朴实而优美。 为了编写对读者更友好的文章,有必要生成文章的标题导航,让读者有个预期的阅读概览。当文章标题比较多时,手工去编写导航锚点比较费时,因此决定使用python解析Markdown文档自动生成标题导航。 知识与思路 写过Markdown的人知道,Markdown的标题是使用一到六个#...

View Article

python 数据类型---列表使用之三

1. 判断列表中是否存在一个元素: "in" 的使用 list = ['Frank', 99, 'is',78, 7,3,4,'smart'] print(99 in list) print(9 in list) #运行结果 True False 2. 元素个数统计: count >>> name = ['3',4,45,4343,34,56,6,7,5,3,9]...

View Article

K-Nearest Neighbor of Lending Club Issued Loans in Python

This was my final project for my Graduate course, Programming Machine Learning Applications at DePaul University . What is K-Nearest Neighbor? In pattern recognition, the k-Nearest Neighbors algorithm...

View Article
Browsing all 9596 articles
Browse latest View live