巴扎黑
浏览量13238    |    粉丝242    |    关注1
  • 巴扎黑

    巴扎黑

    2016-12-09 11:15:30
    python 时间格式化
    函 数strftime()的操作有些类似于sprintf():识别以百分号(%)开始的格式命令集合,格式化输出结果放在一个字符串中。格式化命 令说明串strDest中各种日期和时间信息的确切表示方法。格式串中的其他字符原样放进串中。格式命令列在下面,它们是区分大小写的。 %a 星期几的简写%A 星期几的全称%b 月分的简写%B 月份的全称%c 标准的日期的时间串%C 年份的后两位数字%d 十进制 ...
    1754
  • 巴扎黑

    巴扎黑

    2016-12-09 11:18:31
    python time,datetime,string转换
    # 把datetime转成字符串 def datetime_toString(dt): return dt.strftime("%Y-%m-%d-%H") # 把字符串转成datetime def string_toDatetime(string): return datetime.strptime(string, " ...
    1797
  • 巴扎黑

    巴扎黑

    2016-12-09 11:21:07
    Python的中文字符乱码
    打算用Python解析一下网络日志文件。 必然地遇上了中文乱码的问题。 小弟以前学Java,用Python解决中文乱码的问题真不知道如何入手。 在Java下面调试通过的代码,放在Python环境下就给我闹脾气了。 费我九牛二虎之力,终于在一位Oschina大大的帮助下问题解决了。 Python编码的思路主要是: 1.字符串 2.Unicode 3.目标编码集 其中(CP936 ...
    1768
  • 巴扎黑

    巴扎黑

    2016-12-09 11:25:17
    Python 发送邮件 smtplib
    可以利用smtplib模块来实现发送邮件的功能,一个比较简单的实例代码如下: # Import smtplib for the actual sending function import smtplib # Import the email modules we'll need from email.mime.text import MIMEText # Open a pl ...
    1143
  • 巴扎黑

    巴扎黑

    2016-12-09 11:27:56
    python获取网站图片
    # zhouxianglh 2013.05.03 python3.3 import urllib.request from html.parser import HTMLParser import re import os import shutil import time url = "http://www.douban.com/" filePath = ...
    1379
  • 巴扎黑

    巴扎黑

    2016-12-09 11:41:41
    判断一字符串是否对称,如:abccba
    # 1.判断一字符串是不是对称的,如:abccba def is_symmetrical(str): length = len(str) for index in range(length / 2): if str[index] == str[length - index - 1]: pass else: return False return ...
    6221
  • 巴扎黑

    巴扎黑

    2016-12-09 11:43:01
    用wxpython写的一个天气预报
    自学了半个多月python和wx,想写个天气预报练练手,可是写的时候遇到了很多问题,非常纠结,索性把东西上传给各位看看。东西很简单,就几十行代码� ...
    1754
  • 巴扎黑

    巴扎黑

    2016-12-09 11:49:50
    Python map、filter,reduce介绍
    1、filter(function,iterable) 引用Construct a list from those elements of iterable for which function returns true. iterable may be either a sequence, a container which supports iteration, or an iterator. ...
    1462
  • 巴扎黑

    巴扎黑

    2016-12-09 13:25:01
    redis-python
    #!/usr/bin/env python #coding=utf-8 import os import sys print 'python redis ' import redis import redis r = redis.StrictRedis(host='127.0.0.1', port=6379,db = 4) r.set('one', 'hello') print r.get('one ...
    1342
  • 巴扎黑

    巴扎黑

    2016-12-09 13:27:14
    python tips
    1、enum #!/usr/bin/env python # -*- coding:utf-8 -*- def enum(**enums): return type('Enum', (), enums) Gender = enum(MALE=0,FEMALE=1) print Gender.MALE print Gender.FEMALE 2、检查字符串是否是number ...
    2830

最新下载

更多>
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号