河南卫视武林风官网,齐天大圣闯都市txt,通关状态
1 # 交换两个变量的值,packaging/unpackaging机制 2 x = 2 3 y = 3 4 x, y = y, x 5 print x, y
1 # 字符串格式化 2 print 'hello %(name)s!' % {'name': 'tom'}
1 # 字符串格式化 2 print 'hello {name}!'.format(name='tom')
1 c:\>pip install -u pep8 2 3 c:\users\administrator\desktop\zxt>pep8 --first database.py 4 database.py:83:1: e302 expected 2 blank lines, found 1 5 6 >pep8 --show-source --show-pep8 waijiao.py
1 n = raw_input("please input a number:") 2 if n == "0": 3 print "you typed zero." 4 elif n == "1": 5 print "you are in top." 6 elif n == "2": 7 print "n is an even number." 8 else: 9 print "error!"
1 def func(): 2 return { 3 "0": "you typed zero.", 4 "1": "you are in top.", 5 "2": "n is an even number." 6 }.get(n, "error!")
1 """ 2 requests http library 3 ~~~~~~~~~~~~~~~~~~~~~ 4 requests is an http library, written in python, for human beings. basic get 5 usage: 6 >>> import requests 7 >>> r = requests.get('https://www.python.org') 8 >>> r.status_code 9 200 10 >>> 'python is a programming language' in r.content 11 true 12 ... or post: 13 >>> payload = dict(key1='value1', key2='value2') 14 >>> r = requests.post('http://httpbin.org/post', data=payload) 15 >>> print(r.text) 16 { 17 ... 18 "form": { 19 "key2": "value2", 20 "key1": "value1" 21 }, 22 ... 23 } 24 the other http methods are supported - see `requests.api`. full documentation 25 is at <http://python-requests.org>. 26 :copyright: (c) 2015 by kenneth reitz. 27 :license: apache 2.0, see license for more details. 28 """
1 # -*-coding:utf-8 -*- 2 3 import sys 4 5 6 class _const(object): 7 8 class consterror(typeerror): 9 pass 10 11 class constcaseerror(consterror): 12 pass 13 14 def __setattr__(self, name, value): 15 if self.__dict__.has_key(name): 16 raise self.consterror, "can't change const.{name}".format(name=name) 17 if not name.isupper(): 18 raise self.constcaseerror, 'const name "{name}" is not all uppercase'.format(name=name) 19 self.__dict__[name] = value 20 21 22 sys.modules[__name__] = _const()
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Python 实现将numpy中的nan和inf,nan替换成对应的均值
python爬虫把url链接编码成gbk2312格式过程解析
网友评论