#coding=utf-8

# 函数
def foo(x):
print x foo(123) # import httplib
def check_web_server(host,port,path):
h=httplib.HTTPConnection(host,port)
h.request('GET',path)
resp=h.getresponse()
print 'HTTP Reponse:'
print ' status=',resp.status
print ' reason=',resp.reason
print 'HTTP Headers:'
for hdr in resp.getheaders():
print ' %s:%s ' % hdr check_web_server('www.python.org',80,'/')

python 代码片段20的更多相关文章

  1. Python 代码片段收藏

    list 列表相关 list 中最小值.最大值 import operator values = [1, 2, 3, 4, 5] min_index, min_value = min(enumerat ...

  2. 有用的Python代码片段

    我列出的这些有用的Python代码片段,为我节省了大量的时间,并且我希望他们也能为你节省一些时间.大多数的这些片段出自寻找解决方案,查找博客和StackOverflow解决类似问题的答案.下面所有的代 ...

  3. 2019-01-29 VS Code创建自定义Python代码片段

    续前文[日常]Beyond的歌里最多是"唏嘘"吗? - Python分词+词频最后的想法, 发现VS Code支持用户自定义代码片段: Creating your own snip ...

  4. Python - 代码片段,Snippets,Gist

    说明 代码片段来自网上搬运的或者自己写的 华氏温度转摄氏温度 f = float(input('请输入华氏温度: ')) c = (f - 32) / 1.8 print('%.1f华氏度 = %.1 ...

  5. 32个使用python代码片段

    1.冒泡排序 lis = [56,12,1,8,354,10,100,34,56,7,23,456,234,-58] def sortport():    for i in range(len(lis ...

  6. python 代码片段26

    #coding=utf-8 ''' 使用空格而不是tab 因为无论在什么平台上开发,你的代码总是有可能会被移动或是复制到 另一不同架构的机器上,win32是4个空格,unix是8个空格,干脆 还是使用 ...

  7. python 代码片段25

    #coding=utf-8 # 虽然python是面向对象的语言,但是没有显式的构造函数概念. # python没有new关键词 class MyClass(object): pass m=MyCla ...

  8. python 代码片段23

    #coding=utf-8 #python还支持动态的实力属性,即那些没有在类定义里生命的属性, #可以"凭空"创造出来 john.tatto='Mom' #继承 class Em ...

  9. python 代码片段22

    #coding=utf-8 class AddressBookEntry(object): version=0.1 def __init__(self, name,phone): self.name ...

随机推荐

  1. 创建DLL、Lib以及使用DLL、Lib

    1.要在生成DLL文件的同时生成Lib文件,函数声明时前面要加__declspec(dllexport). 可在头文件中如下定义: #ifndef __MYDLL_H#define __MYDLL_H ...

  2. python中的时间处理函数

    Python提供了多个内置模块用于操作日期时间,像calendar,time,datetime.time模块我在之前的文章已经有所介绍,它提供 的接口与C标准库time.h基本一致.相比于time模块 ...

  3. CentOS出错You don't have permission to access on this server

    之前配置phpmyadmin的时候,在浏览器上输入http://192.168.8.250/phpmyadmin/ 也遇到了You don't have permission to access on ...

  4. AFNetworking请求设置请求头

    NSString *url = @"INPUT URL HERE"; AFHTTPRequestOperationManager *manager = [AFHTTPRequest ...

  5. 跳出IFrame几种方式

    1. <script type="text/javascript"> if (top.location !== self.location) { top.locatio ...

  6. hdu 1075:What Are You Talking About(字典树,经典题,字典翻译)

    What Are You Talking About Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/204800 K ...

  7. 攻城狮在路上(叁)Linux(十六)--- 命令与文件的查找

    一.脚本文件的查询: 1.命令格式:which [-a] command; <==通过PATH来查找. -a:列出所有的,而不是仅列出第一个. 示例: which ifconfig; 注意:由于 ...

  8. MS SQL数据批量备份还原(适用于MS SQL 2005+) 分类: SQL Server 数据库 2015-03-10 14:32 103人阅读 评论(0) 收藏

    我们知道通过Sql代理,可以实现数据库的定时备份功能:当数据库里的数据库很多时,备份一个数据库需要建立对应的定时作业,相对来说比较麻烦: 还好,微软自带的osql工具,比较实用,通过在命令行里里输入命 ...

  9. golang基础知识之文件操作

    读取文件所有内容以及获得文件操作对象 package mainimport ( "bufio" "fmt" "io" "io/io ...

  10. 注解:【无连接表的】Hibernate单向1->N关联

    Person与Address关联:单向1->N,[无连接表的] (性能较低,不推荐使用!) Person.java package org.crazyit.app.domain; import ...