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

python from __future__ import division

1.在 python2 中导入未来的支持的语言特征中division(精确除法),即from __future__ import division ,当我们在程序中没有导入该特征时,"/"操作符执行的只能是整除,也就是取整数,只有当我们导入division(精确算法)以后,"/"执行的才是精确算法。 如: #python 2.7.6 Python 2.7.6 (default, Nov 10...

View Article


Image may be NSFW.
Clik here to view.

《Python高效开发实战》实战演练――基本视图3

在完成Django项目和应用的建立后,即可以开始编写网站应用代码,这里通过为注册页面显示一个欢迎标题,来演示Django的路由映射功能。 1)首先在djangosite/app/views.py中建立一个路由响应函数: from django.http import HttpResponsedef welcome(request):...

View Article


Python数据类型之“序列概述与基本序列类型(Basic Sequences)”

列是指有序的队列,重点在"有序"。 一、python中序列的分类 Python中的序列主要以下几种类型: 3种基本序列类型(Basic Sequence Types):list、tuple、range 专门处理文本的附加序列类型(Text Sequence Types):str 专门处理二进制数据的附加序列类型(Binary Sequence Types):...

View Article

Image may be NSFW.
Clik here to view.

Python详细介绍

本节内容 python简史 Python是一门什么样的语言? Python的优点与缺点 Python解释器 一、Python简史 历史背景...

View Article

Image may be NSFW.
Clik here to view.

Compiling a $22 Logic Analyzer

On my way to this year’s Hackaday SuperConference I saw an article on EE Times about someone taking the $22 Lattice iCEstick and turning it into a logic analyzer complete with a python app to display...

View Article


Python 2 is Stupid

I don't really think that python 2 is stupid, having used it for some years. It's the first programming language that I really came to love; heck, it's the foundation of my career. Python is going...

View Article

Image may be NSFW.
Clik here to view.

Local Django on Kubernetes with Minikube

Minikube It’s been over half a year since I last wrote aboutDjango on Kubernetes, along with Postgres and Redis containers, and I wanted to update it to talk about one of the most exciting projects to...

View Article

Image may be NSFW.
Clik here to view.

“How I Interview Data Scientists” with Matt Fornito

This post was originally published here by Matt Fornito | December 13, 2016 This interview is featured in Springboard’s guide to data science interviews. Matt is also a mentor for Springboard’s Data...

View Article


Python中如何计算两个日期之间的天数?

=Start= 缘由: 在程序中用到和日期相关的循环时,可能会需要提前确定两个日期之间的天数;还有就是在日常的一些记录中也会想了解两个日期之间的天数;总之,这样的需求是很多的。 正文: 参考解答: >>> from datetime import date >>> a = date( 2011 , 11 , 24 ) >>> b = date(...

View Article


Python中如何快速进行多个字符的替换

=Start= 缘由: 在工作中碰到了这么一个问题,记录一下解决方案及其过程,方便以后参考。 正文: 参考解答: 先给出结论: 要替换的字符数量不多时,可以直接链式replace()方法进行替换,效率非常高; 如果要替换的字符数量较多,则推荐在 for 循环中调用 replace() 进行替换。 可行的方法: 1. 链式replace() string.replace().replace() 1.x...

View Article

Image may be NSFW.
Clik here to view.

跟着老男孩教育学Python开发【第四篇】:模块

双层装饰器示例 __author__ = 'Golden' #!/usr/bin/env python # -*- coding:utf-8 -*- USER_INFO = {} def check_login(func): def inner(*args,**kwargs): #如果不存在给定默认值None if USER_INFO. get (" is_login ",None): ret =...

View Article

Experienced Django: Build Tools

I’m doing a survey for build tools in python. Now, before any of you say “make”, be warned that I’ve been doing C and C++ programming for decades and even those project don’t even use make anymore if...

View Article

我的2016年总结

起步 2016年就要结束了,大学生涯也在这一年结束了,自从去年有写博客的想法,现在感觉记录真是一件很有用的东西。 一月 这个月忙于认知实习的一些答辩工作,回公司实习了大概两周,学校寒假了,我也没地方住了,请假回家啦,顺便带着波波去我那玩了几天。 二月 过春节,玩游戏,看直播,吃零食,见基友,月底回学校。 三月...

View Article


Image may be NSFW.
Clik here to view.

初学Python,看这些书够了!

初学python,看这些书够了! 一点号大圣众包4小时前 “不经一番寒彻骨,怎得梅花扑鼻香。”穷到吃土,却还想着升职加薪当上CEO迎娶白富美攀上人生巅峰,但是又懒散不学习,这很不科学。迎接大数据浪潮,大家可以从大数据技术的教学书籍上下手,早日脱离苦海,今天我们大圣众包小编继续为大家精选几本python的书籍! php?url=0FDIDj8lT0" alt="初学Python,看这些书够了!"...

View Article

Image may be NSFW.
Clik here to view.

How a BBC Data Unit Scraped Airport Noise Complaints

I’d wondered for a while why no one who had talked about scraping at conferences had actually demonstrated the procedure. It seemed to me to be one of the most sought-after skills for any...

View Article


Python之路【第十九章】:Django 数据库对象关系映射

Django ORM基本配置 到目前为止,当我们的程序涉及到数据库相关操作时,我们一般都会这么搞: 创建数据库,设计表结构和字段 使用 mysqldb 来连接数据库,并编写数据访问层代码 业务逻辑层去调用数据访问层执行数据库操作 django为使用一种新的方式,即:关系对象映射(Object Relational Mapping,简称ORM),django中遵循 Code Frist...

View Article

Image may be NSFW.
Clik here to view.

JSON WEB TOKEN BASED Authentication Backend for Django Project

In our last post we gave a detailed description about JSON Web Tokens. In this post we are going to show a sample JSON Web Token Authentication mechanism with the Django Web Framework. Owasp defines...

View Article


Image may be NSFW.
Clik here to view.

Working with zip files in Python

This article explains how one can perform various operations on a zip file using a simple python program. What is a zip file? ZIP is an archive file format that supports lossless data compression. By...

View Article

Image may be NSFW.
Clik here to view.

Setup Microservices Architecture in Python with ZeroMQ & Docker

Microservices - What? Microservices are an architectural style in which multiple, independent processes communicate with each other. These processes are designed to be highly scalable, are de-coupled...

View Article

numpy常用用法总结

numpy 简介 numpy的存在使得python拥有强大的矩阵计算能力,不亚于matlab。 官方文档( https://docs.scipy.org/doc/numpy-dev/user/quickstart.html ) 各种用法介绍 首先是numpy中的数据类型,ndarray类型,和标准库中的array.array并不一样。 ndarray的一些属性 ndarray.ndim the...

View Article
Browsing all 9596 articles
Browse latest View live