码迷,mamicode.com
首页 >  
搜索关键字:python    ( 135041个结果
python琐碎语法
1 python是强类型语言,变量必须声明且初始化,而且变量名称在不同地方可以代表不同类型的变量; 2 C语言中变量名代表了数据的存放位置,而python中变量名只是一个对象的引用,而id(变量)才能给出变量地址,type(...
分类:编程语言   时间:2014-11-12 18:16:13    阅读次数:181
Python编写九九乘法表
x=1 whilex<10: y=list(range(x)) forziny: z+=1 print(‘%d*%d=%d‘%(x,z,x*z),end=‘‘) x+=1 print(‘\n‘)
分类:编程语言   时间:2014-11-12 17:58:56    阅读次数:237
Beginning Python From Novice to Professional (4) - 字符串格式示例
$ gedit price.py #!/usr/bin/env python width = input('Please enter width: ') price_width = 10 item_width = width - price_width header_format = '%-*s%*s' format = '%-*s%*.2f' print '=' * width...
分类:编程语言   时间:2014-11-12 16:33:21    阅读次数:248
Think in java 源码如何导入
thinking in java 源码导入...
分类:编程语言   时间:2014-11-12 16:31:11    阅读次数:226
Beginning Python From Novice to Professional (3) - 列表操作
列表操作 list函数: >>> list('hello') ['h', 'e', 'l', 'l', 'o']改变列表: >>> x=[1,1,1] >>> x[1]=2 >>> x [1, 2, 1]删除元素: >>> names = ['wu','li','zhao','qian'] >>> del names[1] >>> names ['wu', 'zhao', 'qian']分...
分类:编程语言   时间:2014-11-12 15:06:10    阅读次数:142
Beginning Python From Novice to Professional (1) - 数字和表达式
数字和表达式 加减乘除: >>> 2+2 4 >>> 100-50 50 >>> 3*5 15 >>> 1/2 0 >>> 1.0/2.0 0.5求余、乘方: >>> 1%2 1 >>> 10%3 1 >>> 2**3 8 >>> -3**2 -9 >>> (-3)**2 9十六进制、八进制: >>> 0xff 255 >>> 020 16变量: >>> x=3 >>> x*2 6获取输...
分类:编程语言   时间:2014-11-12 13:53:31    阅读次数:211
Beginning Python From Novice to Professional (2) - 命令行运行Python脚本
命令行运行Python脚本 Linux下先创建一个hello.py $ gedit hello.py 输入: #!/usr/bin/env python print 2+2保存退出,运行: $ python hello.py 4我们也可以让它变得和普通程序一样执行 执行之前,让脚本文件具备可执行属性: $ chmod a+x hello.py运行脚本: $ ./hello.py ...
分类:编程语言   时间:2014-11-12 13:47:51    阅读次数:180
[leetcode] Min Stack @ Python
原题地址:https://oj.leetcode.com/problems/min-stack/解题思路:开辟两个栈,一个栈是普通的栈,一个栈用来维护最小值的队列。代码:class MinStack: # @param x, an integer def __init__(self): ...
分类:编程语言   时间:2014-11-12 13:44:19    阅读次数:213
第十四章 openwrt 安装 python
需要安装libffi,python-mini,python。libffi以及python-mini需要安装在python之前 如果部分软件包不一样可以在下面的web后台搜索,搜索前先opkg update Opkg installl 下载setuptools http://pypi.python.o...
分类:编程语言   时间:2014-11-12 13:31:35    阅读次数:275
第一章 在linux下python读串口 存MYSQL数据库(703N)
import MySQLdb//定义引用数据库的驱动文件import serialimport timeser = serial.Serial('/dev/ttyATH0', 115200, timeout=65)//读串口while True:data = ser.readline()print ...
分类:数据库   时间:2014-11-12 13:30:59    阅读次数:279
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!