Python基础教程之第5章 条件, 循环和其它语句
- Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32
- #Chapter 5 条件, 循环和其它语句
- #5.1 print和import的很多其它信息
- #对于非常多应用程序来说, 使用logging模块记日志比print语句更合适
- #5.1.1 使用逗号输出
- #能够看到, 每隔參数之间都自己主动插入了一个空格符
- >>> print 'Age:',42
- Age: 42
- >>> 1,2,3
- (1, 2, 3)
- #print的參数并不像我们预期那样构成一个元组
- >>> print 1,2,3
- 1 2 3
- >>> print (1,2,3)
- (1, 2, 3)
- >>> name='Gumby'
- >>> salution='Mr.'
- >>> greeting='Hello,'
- >>> print greeting, salution, name
- Hello, Mr. Gumby
- >>> greeting='Hello'
- >>> print greeting, ',', salution, name
- Hello , Mr. Gumby
- >>> print greeting + ',', salution, name
- Hello, Mr. Gumby
- #假设在结尾处加上逗号,那么接下来的语句会与前一语句在同一行打印(仅仅在脚本中起作用,在交互式Python会话中无效)
- print 'Hello,',
- print 'world!'
- #输出Hello, world!
- #5.1.2 import语句
- #import somemodule
- #from somemodule import somefunction
- #from somemodule import somefunction, anotherfunction, yetanotherfunction
- #from somemodule import *
- #为模块提供别名
- >>> import math as foobar
- >>> foobar.sqrt(4)
- 2.0
- #为函数提供别名
- >>> from math import sqrt as foobar
- >>> foobar(4)
- 2.0
- #给不同模块中的同名函数提供别名
- #from module1 import open as open1
- #from module2 import open as open2
- #5.2 赋值魔法
- #5.2.1 序列解包(sequence unpacking)
- >>> x, y, z = 1, 2, 3
- >>> print x, y, z
- 1 2 3
- >>> x, y = y, x
- >>> print x, y, z
- 2 1 3
- >>> values = 1,2,3
- >>> values
- (1, 2, 3)
- >>> x,y,z=values
- >>> x
- 1
- >>> y
- 2
- >>> z
- 3
- >>> scoundrel={'name':'Robin', 'girlfriend':'Marion'}
- >>> key, value = scoundrel.popitem()
- >>> key
- 'girlfriend'
- >>> value
- 'Marion'
- >>> x,y,z = 1,2
- Traceback (most recent call last):
- File "<pyshell#31>", line 1, in <module>
- x,y,z = 1,2
- ValueError: need more than 2 values to unpack
- >>> x,y,z=1,2,3,4
- Traceback (most recent call last):
- File "<pyshell#32>", line 1, in <module>
- x,y,z=1,2,3,4
- ValueError: too many values to unpack
- #Python 3.0 中有另外一个解包的特性
- #a,b,rest*=[1,2,3,4]
- #rest的结果将会是[3,4]
- #5.2.2 链式赋值
- #x=y=somefunction
- #等效于
- #y=somefunction
- #x=y
- #5.2.3 增量赋值(augmented assignment)
- >>> x=2
- >>> x += 1
- >>> x *= 2
- >>> x
- 6
- >>> fnord = 'foo'
- >>> fnord += 'bar'
- >>> fnord *= 2
- >>> fnord
- 'foobarfoobar'
- #语句块: 缩排的乐趣
- #5.4 条件和条件语句
- # False None 0 "" '' () [] {} 会被解释器看做假
- >>> True
- True
- >>> False
- False
- >>> True == 1
- True
- #标准的布尔值为False(0)和True(1)
- >>> False == 0
- True
- >>> True + False + 42
- 43
- #bool函数能够用来(和list, str以及tuple相似)转换其它值
- >>> bool('I think, therefore I am')
- True
- >>> bool(42)
- True
- >>> bool('')
- False
- >>> bool(0)
- False
- >>> bool([])
- False
- >>> bool(())
- False
- >>> bool({})
- False
- #5.4.2 条件运行和if语句
- >>> name = raw_input('What is your name?
- ')
- What is your name? Gumby
- >>> if name.endswith('Gumby'):
- ... print 'Hello, Mr. Gumby'
- ...
- Hello, Mr. Gumby
- #5.4.3 else子句
- >>> name = raw_input('What is your name? ')
- What is your name?
- Jon
- >>> if name.endswith('Gumby'):
- ... print 'Hello, Mr. Gumby'
- ... else:
- ... print 'Hello, stranger'
- ...
- Hello, stranger
- #5.4.4 elif子句
- >>> num = input('Enter a number: ')
- Enter a number: 0
- >>> if num > 0:
- ... print 'The number is positive'
- ... elif num < 0:
- ... print 'The number is negative'
- ... else:
- ... print 'The number is zero'
- ...
- The number is zero
- #5.4.5 嵌套代码块
- >>> name = raw_input('What is your name? ')
- What is your name? Mrs. Gumby
- >>> if name.endswith('Gumby'):
- ... if name.startswith('Mr.'):
- ... print 'Hello, Mr. Gumby'
- ... elif name.startswith('Mrs.'):
- ... print 'Hello, Mrs. Gumby'
- ... else:
- ... print 'Hello, Gumby'
- ... else:
- ... print 'Hello, stranger'
- ...
- Hello, Mrs. Gumby
- #链式比較运算
- #比較对象的时候能够使用内建的cmp函数
- >>> age=10
- >>> 0<age<100
- True
- >>> age=-1
- >>> 0<age<100
- False
- #相等运算符
- >>> "foo" == "foo"
- True
- >>> "foo" == "bar"
- False
- >>> "foo" = "foo"
- File "<stdin>", line 1
- SyntaxError: can't assign to literal
- #同一性运算符
- #避免将is运算符用于比較相似数值和字符串这类不可变值.
- >>> x=y=[1,2,3]
- >>> z=[1,2,3]
- >>> x == y
- True
- >>> x == z
- True
- >>> x is y
- True
- >>> x is z
- False
- >>>
- >>> x is z
- False
- >>> x = [1,2,3]
- >>> y = [2,4]
- >>> x is not y
- True
- >>> del x[2]
- >>> y[1]=1
- >>> y.reverse()
- >>> x == y
- True
- >>> x is y
- False
- #in: 成员资格运算符
- >>> name = raw_input('What is your name? ')
- What is your name?
- Jonathan
- >>> if 's' in name:
- ... print 'Your name contains the letter "s".'
- ... else:
- ... print 'Your name does not contain the letter "s".'
- ...
- Your name does not contain the letter "s".
- >>> "alpha" < "beta"
- True
- >>> 'FnOrd'.lower() == 'Fnord'.lower()
- True
- >>> [1,2] < [2,1]
- True
- >>> [2,[1,4]]<[2,[1,5]]
- True
- #布尔运算符
- >>> number = input('Enter a number between 1 and 10: ')
- Enter a number between 1 and 10: 8
- >>> if number <= 10:
- ... if number >=1:
- ... print 'Great!'
- ... else:
- ... print 'Wrong!'
- ... else:
- ... print 'Wrong!'
- ...
- Great!
- >>> number = input('Enter a number between 1 and 10: ')
- Enter a number between 1 and 10: 6
- >>> if number <= 10 and number >= 1:
- ... print 'Great!'
- ... else:
- ... print 'Wrong!'
- ...
- Great!
- >>> number = input('Enter a number between 1 and 10: ')
- Enter a number between 1 and 10: 11
- >>> if 1 <= number <= 10:
- ... print 'Great!'
- ... else:
- ... print 'Wrong!'
- ...
- Wrong!
- >>> name = raw_input('Please enter your name: ') or '<unknown>'
- Please enter your name:
- >>> name
- '<unknown>'
- #短路逻辑和条件表达式
- #相似C和Java中的三元运算符
- >>> name = 'Jon'if True else 'Jack'
- >>> name
- 'Jon'
- >>> name = 'Jon'if False else 'Jack'
- >>> name
- 'Jack'
- #5.4.7 断言
- >>> age = 10
- >>> assert 0 < age < 100
- >>> age = -1
- >>> assert 0 < age < 100
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- AssertionError
- #条件后能够加入逗号和字符串,用来解释断言
- >>> age = -1
- >>> assert 0 < age < 100, 'The age must be realistic'
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- AssertionError: The age must be realistic
- #5.5 循环
- #5.5.1 while循环
- >>> x=1
- >>> while x <= 100:
- ... print x
- ... x +=1
- ...
- 1
- 2
- 3
- ...
- 100
- >>> x
- 101
- >>> name = ''
- >>> while not name:
- ... name = raw_input('Please enter your name: ')
- ...
- Please enter your name:
- Please enter your name:
- Please enter your name: Jon
- >>> print 'Hello, %s!' % name
- Hello, Jon!
- >>> name = ''
- >>> while not name or name.isspace():
- ... name = raw_input('Please enter your name: ')
- ...
- Please enter your name:
- Please enter your name:
- Please enter your name: Chan
- >>> print 'Hello, %s!' % name
- Hello, Chan!
- >>> while not name.strip():
- ... name = raw_input('Please enter your name: ')
- ...
- >>> name = ''
- >>> while not name.strip():
- ... name = raw_input('Please enter your name: ')
- ...
- Please enter your name:
- Please enter your name:
- Please enter your name: Kingston
- >>> print 'Hello, %s!' % name
- Hello, Kingston!
- #5.5.2 for循环
- >>> words=['this', 'is', 'an', 'ex', 'parrot']
- >>> for word in words:
- ... print word
- ...
- this
- is
- an
- ex
- parrot
- >>> numbers = [0,1,2,3,4,5,6,7,8,9]
- >>> for number in numbers:
- ... print number
- ...
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- >>> range(10)
- [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
- #假设能使用for循环,就尽量不用while循环
- #当须要迭代一个巨大的序列时,xrange会比range更高效
- >>> for number in range(1,5):
- ... print number
- ...
- 1
- 2
- 3
- 4
- #5.5.3 循环遍历字典元素
- >>> d={'x':1, 'y':2, 'z':3}
- >>> for key in d:
- ... print key, 'corresponds to', d[key]
- ...
- y corresponds to 2
- x corresponds to 1
- z corresponds to 3
- >>> for key, value in d.items():
- ... print kye, 'corresponds to', value
- ...
- Traceback (most recent call last):
- File "<stdin>", line 2, in <module>
- NameError: name 'kye' is not defined
- >>> for key, value in d.items():
- ... print key, 'corresponds to', value
- ...
- y corresponds to 2
- x corresponds to 1
- z corresponds to 3
- >>>
- #5.5.4 一些迭代工具
- #并行迭代
- >>> names = ['anne', 'beth', 'george', 'damon']
- >>> ages = [12, 45, 32, 102]
- >>> for in in range(len(names)):
- SyntaxError: invalid syntax
- >>> for i in range(len(names)):
- print names[i], 'is', ages[i], 'year old'
- anne is 12 year old
- beth is 45 year old
- george is 32 year old
- damon is 102 year old
- >>> for i in range(len(names)):
- print names[i], 'is', ages[i], 'years old'
- anne is 12 years old
- beth is 45 years old
- george is 32 years old
- damon is 102 years old
- >>> zip(names, ages)
- [('anne', 12), ('beth', 45), ('george', 32), ('damon', 102)]
- >>> for name, age in zip(names, ages):
- print name, 'is', age, 'years old'
- anne is 12 years old
- beth is 45 years old
- george is 32 years old
- damon is 102 years old
- >>> zip(range(5), xrange(100000000))
- [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)]
- #在索引上迭代
- >>> strings = ['I am xxx', 'I like losing my face', 'Say goodbye']
- >>> for string in strings:
- index = strings.index(string) # Search for the string in the list of strings
- strings[index]='[censored]'
- >>> strings
- ['[censored]', '[censored]', '[censored]']
- >>> strings = ['I am xxx', 'I like losing my face', 'Say goodbye']
- >>> for string in strings:
- if 'xxx'in strings:
- index = strings.index(string) # Search for the string in the list of strings
- strings[index]='[censored]'
- >>> strings
- ['I am xxx', 'I like losing my face', 'Say goodbye']
- >>> strings = ['I am xxx', 'I like losing my face', 'Say goodbye']
- >>> for string in strings:
- if 'xxx' in string:
- index = strings.index(string) # Search for the string in the list of strings
- strings[index]='[censored]'
- >>>
- >>> string
- 'Say goodbye'
- >>> strings
- ['[censored]', 'I like losing my face', 'Say goodbye']
- >>> ['I am xxx', 'I like losing my face', 'Say goodbye']
- ['I am xxx', 'I like losing my face', 'Say goodbye']
- >>> index = 0
- >>> for string in strings:
- if 'xxx' in string:
- strings[index]='[censored]'
- index += 1
- SyntaxError: invalid syntax
- >>> index = 0
- >>> for string in strings:
- if 'xxx' in string: strings[index]='[censored]'
- index += 1
- >>> strings
- ['[censored]', 'I like losing my face', 'Say goodbye']
- >>> ['I am xxx', 'I like losing my face', 'Say goodbye', 'xxx is a sensitive word']
- ['I am xxx', 'I like losing my face', 'Say goodbye', 'xxx is a sensitive word']
- >>> for index, string in enumerate(strings):
- if 'xxx' in string:
- strings[index]='[censored]'
- >>> strings
- ['[censored]', 'I like losing my face', 'Say goodbye']
- >>> strings = ['I am xxx', 'I like losing my face', 'Say goodbye', 'xxx is a sensitive word']
- #enumerate函数能够在提供索引的地方迭代索引-值对.
- >>> for index, string in enumerate(strings):
- if 'xxx' in string:
- strings[index]='[censored]'
- >>> strings
- ['[censored]', 'I like losing my face', 'Say goodbye', '[censored]']
- #翻转和排序迭代
- >>> sorted([4,3,6,8,3])
- [3, 3, 4, 6, 8]
- >>> sorted('Hello, world!')
- [' ', '!', ',', 'H', 'd', 'e', 'l', 'l', 'l', 'o', 'o', 'r', 'w']
- >>> list(reversed('Hello, world'))
- ['d', 'l', 'r', 'o', 'w', ' ', ',', 'o', 'l', 'l', 'e', 'H']
- >>> ''.join(reversed('Hello, world!'))
- '!dlrow ,olleH'
- #5.5.5 跳出循环
- #break
- >>> from math import sqrt
- >>> for n in range(99, 0, -1);
- SyntaxError: invalid syntax
- >>> for n in range(99, 0, -1):
- root = sqrt(n)
- if root == int(root):
- print n
- break
- 81
- # continue
- # while True/break习惯使用方法
- >>> word = 'dummy'
- >>> while word:
- word = raw_input('Please enter a word: ')
- # 处理word:
- print 'The word was ' + word
- Please enter a word: first
- The word was first
- Please enter a word: second
- The word was second
- Please enter a word:
- The word was
- >>> word = raw_input('Please enter a word: ')
- Please enter a word: first
- >>> while word:
- print 'The word was ' + word
- word = raw_input('Please enter a word: ')
- The word was first
- Please enter a word: second
- The word was second
- Please enter a word:
- >>> while True:
- word = raw_input('Please enter a word: ')
- if not word: break
- print 'The word was ' + word
- Please enter a word: first
- The word was first
- Please enter a word: second
- The word was second
- Please enter a word:
- #5.5.6 循环中else子句
- #原始方案
- from math import sqrt
- break_out = False
- for n in range(99, 81, -1):
- root = sqrt(n)
- if root == int(root):
- break_out = True
- print n
- break
- if not break_out:
- print "Didn't find it!"
- #结果Didn't find it!
- #改进方案
- from math import sqrt
- for n in range(99, 81, -1):
- root = sqrt(n)
- if root == int(root):
- print n
- break
- else:
- print "Didn't find it!"
- #结果Didn't find it!
- #列表推导式(list comprehension)--轻量级循环
- >>> [x*x for x in range(10)]
- [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
- #能够和if子句联合使用
- >>> [x*x for x in range(10) if x % 3 == 0]
- [0, 9, 36, 81]
- >>> [(x,y) for x in range(3) for y in range(3)]
- [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)]
- >>>
- >>> result=[]
- >>> for x in range(3):
- for y in range(3):
- result.append((x,y))
- >>> result
- [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)]
- >>> girls=['alice', 'bernice', 'clarice']
- >>> boys=['chris', 'arnold', 'bob']
- >>> [b+'+'+g for b in boys for g in girls if b[0] == g[0]]
- ['chris+clarice', 'arnold+alice', 'bob+bernice']
- #更优方案
- >>> girls = ['alice', 'bernice', 'clarice']
- >>> boys = ['chris', 'arnold', 'bob']
- >>> letterGirls={}
- >>> for girl in girls:
- letterGirls.setdefault(girl[0], []).append(girl)
- >>> print [b+'+'+g for b in boys for g in letterGirls[b[0]]]
- ['chris+clarice', 'arnold+alice', 'bob+bernice']
- >>> letterGirls
- {'a': ['alice'], 'c': ['clarice'], 'b': ['bernice']}
- #5.7 三人行 pass, del 和 exec
- #5.7.1 什么都没发生
- >>> name = 'Bill Gates'
- >>> if name == 'Ralph Auldus Melish':
- ... print 'Welcome!'
- ... elif name == 'Enid':
- ... pass
- ... elif name == 'Bill Gates':
- ... print 'Access Denied'
- ...
- Access Denied
- #5.7.2 使用del删除
- >>> scoundrel = {'age':42, 'first name':'Robin', 'last name':'of Locksley'
- >>> robin = scoundrel
- >>> scoundrel
- {'last name': 'of Locksley', 'first name': 'Robin', 'age': 42}
- >>> robin
- {'last name': 'of Locksley', 'first name': 'Robin', 'age': 42}
- >>> scoundrel = None
- >>> scoundrel
- >>> print scoundrel
- None
- >>> robin
- {'last name': 'of Locksley', 'first name': 'Robin', 'age': 42}
- >>> x = 1
- >>> y = x
- >>> x=1
- >>> del x
- >>> x
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- NameError: name 'x' is not defined
- >>> x = ['Hello', 'world']
- >>> y = x
- >>> y[1]='Python'
- >>> x
- ['Hello', 'Python']
- >>> del x
- >>> y
- ['Hello', 'Python']
- #5.7.3 使用exec和eval运行和求值字符串
- # exec 在 Python 3.0 中是一个函数而不是语句
- >>> exec "print 'Hello, world!'"
- Hello, world!
- >>> from math import sqrt
- >>> exec "sqrt=1"
- >>> sqrt(4)
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- TypeError: 'int' object is not callable
- #命名空间,或称为作用域(scope)
- #能够通过in <scope> 来实现, 当中的<scope>就是起到放置代码字符串命名空间作用的字典
- >>> from math import sqrt
- >>> scope={}
- >>> exec 'sqrt = 1' in scope
- >>> sqrt(4)
- 2.0
- >>> scope ['sqrt']
- 1
- >>> len(scope)
- 2
- >>> scope.keys()
- ['__builtins__', 'sqrt']
- # eval--求值字符串
- >>> eval(raw_input("Enter an arithmetic express: "))
- Enter an arithmetic express: 6 + 18 * 2
- 42
- >>> scope={}
- >>> scope['x']=2
- >>> scope['y']=3
- >>> eval('x * y', scope)
- 6
- >>> scope = {}
- >>> exec 'x=2' in scope
- >>> eval('x*x', scope)
- 4
- >>>
- #5.8 小结
- #打印--print语句能够用来打印由逗号隔开的多个值. 假设语句以逗号结尾,随后的print语句会在同一行内接续打印
- #导入--能够用as对模块或函数提供别名
- #赋值--通过 序列解包 和 链式赋值 功能, 多个变量能够一次性赋值, 通过 增量赋值 能够原地改变变量
- #块--块是通过缩排使语句成组的一种方法. 块能够在条件以及循环语句中使用,也能够在函数和类中使用
- #条件--几个条件能够串联使用if/elif/else. 另一个变体叫做条件表达式,形如a if b else c.
- #断言--断言简单来说就是肯定某事(布尔表达式)为真, 也可在它后面跟上这么觉得的原因.
- #循环--能够使用continue语句跳过块中的其它语句然后继续下一次迭代, 或使用break语句跳出循环
- # 还能够选择在循环结尾加上else子句, 当没有运行循环内部的break语句时便会运行else子句中的内容.
- #列表推导式--是看起来像循环的表达式.通过它, 能够从旧列表中产生新的列表, 对元素应用函数, 过滤掉不须要的元素,等等.
- #pass, del, exec 和 eval 语句. pass语句什么都不做, 能够作为占位符使用. del语句用来删除变量(名称),或数据结构的一部分, 可是不能用来删除值.
- # exec语句用与运行Python程序同样的方式来运行字符串. 内建的eval函数对字符串中的表达式进行求值并返回结果.
- #5.8.1 本章的新函数
- #chr(n) 返回序数n所代表的字符的字符串(0<=n<=256)
- #eval(source[, globals[, locals]]) 将字符串作为表达式计算,而且返回值
- #enumerate 产生用于迭代的(索引,值)对
- #ord(c) 返回单字符字符串的int值
- #range([start,] stop[, step]) 创建整数的列表
- #reversed(seq) 产生seq中值的反向副本, 用于迭代
- #sorted(seq[, cmp][, key][, reverse]) 返回seq中值排序后的列表副本
- #xrange([start,] stop[, step]) 创建xrange对象用于迭代
- #zip(seq1, seq2,...) 创建用于并行迭代的新序列
Python基础教程之第5章 条件, 循环和其它语句的更多相关文章
- Python基础教程之第2章 列表和元组
D:\>python Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Typ ...
- Python基础教程之第3章 使用字符串
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type "copyri ...
- Python基础教程之第1章 基础知识
#1.1 安装Python #1.1.1 Windows #1.1.2 Linux和UNIX #1.1.3 Macintosh #1.1.4 其它公布版 #1.1.5 时常关注.保持更新 #1.2 交 ...
- Python基础教程之List对象 转
Python基础教程之List对象 时间:2014-01-19 来源:服务器之家 投稿:root 1.PyListObject对象typedef struct { PyObjec ...
- Python基础教程之udp和tcp协议介绍
Python基础教程之udp和tcp协议介绍 UDP介绍 UDP --- 用户数据报协议,是一个无连接的简单的面向数据报的运输层协议.UDP不提供可靠性,它只是把应用程序传给IP层的数据报发送出去,但 ...
- python基础教程第5章——条件循环和其他语句
1.语句块是在条件为真(条件语句)时执行或者执行多次(循环语句)的一组语句.在代码前放置空格来缩进语句即可穿件语句块.块中的每行都应该缩进同样的量.在Phyton中冒号(:)用来标识语句块的开始,块中 ...
- python基础教程之pymongo库
1. 引入 在这里我们来看一下Python3下MongoDB的存储操作,在本节开始之前请确保你已经安装好了MongoDB并启动了其服务,另外安装好了Python的PyMongo库. 1. 安装 pi ...
- Python基础教程之dict和set
1. dict Python中的dict等于js中的 map ,使用键-值(key-value)存储,具有极快的查找速度. 如果 我们要根据同学的姓名去查找他的成绩在不用dict的情况下.就需要两个l ...
- OpenVAS漏洞扫描基础教程之OpenVAS概述及安装及配置OpenVAS服务
OpenVAS漏洞扫描基础教程之OpenVAS概述及安装及配置OpenVAS服务 1. OpenVAS基础知识 OpenVAS(Open Vulnerability Assessment Sys ...
随机推荐
- Learning Face Age Progression: A Pyramid Architecture of GANs
前言 作为IP模式识别的CNN初始模型是作为单纯判别式-模式识别存在的,并以此为基本模型扩展到各个方向.基本功能为图像判别模型,此后基于Loc+CNN的检测模型-分离式.end2end.以及MaskC ...
- webstom2017最新破解 ------------ http://blog.csdn.net/voke_/article/details/76418116
webstorm 作为最近最火的前端开发工具,也确实对得起那个价格,但是秉着勤俭节约的传统美德,我们肯定是能省则省啊. 方法一:(更新时间:2018/1/23)v3.3 注册时,在打开的License ...
- Java实现打包文件
把文件打包到压缩包里 public void zip (String... files) throws IOException { //创建文件打包流对象 ZipOutputStream zos = ...
- vue组件---动态组件之多标签页面
首先看下效果图 代码: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> & ...
- 网络编程 - socket实现多个连接处理
#服务端import socket,osso_server=socket.socket()so_server.bind(("localhost",6969))so_server.l ...
- java基础学习日志--异常案例
package test7; public class InvalidScroreException extends Exception { public InvalidScroreException ...
- 洛谷——P3946 ことりのおやつ(小鸟的点心)
P3946 ことりのおやつ(小鸟的点心) 题目太长,请去链接里看吧 注意细节:特判终点(即使困住又能怎样,到达就好了),特判高度 #include<bits/stdc++.h> #defi ...
- msdn的原版windows下载地址链接
http://msdn.itellyou.cn/ 所有版本的下载地址 进去点左边操作系统
- BZOJ 1468 Tree 【模板】树上点分治
#include<cstdio> #include<algorithm> #define N 50010 #define M 500010 #define rg registe ...
- POJ 3468 线段树区间修改查询(Java,c++实现)
POJ 3468 (Java,c++实现) Java import java.io.*; import java.util.*; public class Main { static int n, m ...