Python学习笔记一 基础知识

Lovely Python整理
Python - 弱数据类型,不需要强制声明
Python - 一切都是对象
Pyhton - 语句块以:结尾,并且下句缩进
Python -  复用级别 代码行→函式→类→模块
Python - 支持函数
Python - KISS原则 == Keep It Simple,Stupid
一、中文支持
# -*- coding: utf-8 -*-


二、使用模块
import os, sys,cmd
fromt cdctools.py import *
from threading import Thread #多线程
三、模块
os.listdir('path');
os.walk('path')
文件操作
open('fileName','a/w').write('content');
四、函数
def method(param1,param2):
doSomething
五、命令行交互
import sys
sys.arg[x]
六、类
class ClassName(cmd.Cmd):
def __init__(self):
cmd.Cmd.__init__(self)
if __name__ ==  ' __main__ ':
doSomething
线程
class grepIt(Thread):
def __init__(self,param1,param2):
Thread.__init__(self)
七、语法
filelist = os.listdir('path')
for cdc in filelist:
if ".cdc" in  cdc:
if keword  in line:
print line
异常捕获
try:
for type in tryuni:
try:
ustring = unicode("%s}"%type+stream, type)
#try decode by list
except:
continue
#break!continue try decode guess
except:
return u"bad unicode encode!"
八、其他工具
chardet 编码探测
epydoc py文档生成器
ConfigParser 文件操作API
Web框架
Karrigell WebFrameworks
web.py
九、其他
桌面开发 Tk/Tcl Qt WxPython win32com

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值