首页
学习
活动
专区
工具
TVP
发布

从零开始的linux

专栏作者
103
文章
131643
阅读量
39
订阅数
python运算符
算数运算符 符号描述例子-减法3 - 2=1+加法3 + 2=5*乘法3 * 2=6/除法4 / 2=2%取模 取余数3 % 2=1**幂2 ** 3=8//取整除,除尽9 // 2=4 逻辑运算符号 优先级是递减() not and or 关系运算符 符号描述例子== 等于(1 == 2) 返回 False!=不等于(1 != 2) 返回 true<>不等于(1 <> 2) 返回 true。这个运算符类似 !=<小于(1 > 2) 返回 False>大于(1 < 2) 返回 true>=大于等于(1 >=
零月
2018-04-25
9660
python条件判断
if判断 a= 1 if a>10: print 'a大于10' print 'a小于10' a = -20 if a > 10: print ('a > 10') elif a==0: print 'a is 0' else: print 'a is fushu' while循环 x = 10 while x >0: print '22222' x-=1 abc = 10 while abc > 0: print ('abc = %s' % a
零月
2018-04-25
1.7K0
用python解释mapreduce
map import sys #输入为标准输出stdin for line in sys.stdin: #删除开头和结尾的空行 line = line.strip() #以默认空格分隔单词到words列表 words = line.split() for word in words: #输出所有单词,格式为“单词,1”以便为reduce的输入 print '%s %s' % (word,1) reduce import sys cur
零月
2018-04-25
6700
二分查找(python)
假期无聊,在家无网络,就看了看传说中的算法,一个字难 下面都是本人的愚见,如有不对请谅解: 二分查找的前提是有序其次是排除一半,比如1..100之间猜一个数值的大小,从50猜起,去掉一半,大了还是小
零月
2018-04-25
8510
猜数字小游戏
import random import sys num=random.randint(1,20) print "------------------------------------------------------------------------------" print '''Game rules: There is a integer between 1 and 20.If you can guess it in six chances,you win the game,otherwise
零月
2018-04-25
7030
了解ansible
由于工作需要重温ansible 安装ansible [root@ansible ~]# yum -y install ansible python多线程 最大支持5个1(1s)2(1s)3(1s)4(1s)5(3s)慢一些保证一致性10个线程要跑最大支持5 个1 2 3 4 5 1换成6 这样快的情况会有线程锁了解生产者消费者模型python2.7是假的多线程python3是真的多线程python2.7可以用多进程来实现 ansible源码 whereis ansibleansible: /us
零月
2018-04-25
1K1
python变量
python下变量是对一个数据的引用 >>> a=123 >>> id(a) 39435920L 四则小运算 #!/usr/bin/pythonnum1 = input("please a number:")num2 = input("please a number:")print "%s + %s = %s" % (num1, num2, num1+num2)print "%s - %s = %s" % (num1, num2, num1-num2)print "%s * %s = %s" % (num1
零月
2018-04-25
1.2K0
python字符串类型
字符串长度 >>> a = 'hello python'>>> len(a)12 字符串取值从0开始 >>> a[0]'h' >>> a[1]'e' >>> a[-1]'n' 后一位不包括 >>> a[2:4]'ll' >>> a[2]'l'>>> a[4]'o' 取全部 >>> a[:]'hello python' >>> a[4:]'o python'>>> a[:-1]'hello pytho' 重复 >>> a'hello python'>>> a * 3'hello pythonhello pyt
零月
2018-04-25
6950
初识ansible
Ansible是一个简单的自动化运维管理工具,基于Python语言实现 ansible2.2已经支持ZeroMQ 部署简单,只需在主控端部署Ansible环境,被控端无需做任何操作; 默认使用SSH协
零月
2018-04-25
7320
安装ipython和虚拟环境
先epel-release这个包, 通过epel源安装pip: yum install python-pip 然后pip install ipython==1.2.1 pip install ipython==1.2.1 DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support fo
零月
2018-04-25
1K0
没有更多了
社区活动
腾讯技术创作狂欢月
“码”上创作 21 天,分 10000 元奖品池!
Python精品学习库
代码在线跑,知识轻松学
博客搬家 | 分享价值百万资源包
自行/邀约他人一键搬运博客,速成社区影响力并领取好礼
技术创作特训营·精选知识专栏
往期视频·千货材料·成员作品 最新动态
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档