python常见用法

Python 标准库一览(Python进阶学习)

Python开源框架、库、软件和资源大集合

https://www.numpy.org/

git clone https://github.com/numpy/numpy.git numpy

git clone https://github.com/scipy/scipy.git scipy

python setup.py install


Built-in Functions

1 python中python 中__name__ = '__main__' 的作用

2 python注释

3 python中import和from...import区别

4 python打包工具pyinstaller:

 使用 PyInstaller 把python程序 .py转为 .exe 可执行程序

 如何使用pyinstaller打包python脚本?

 pyinstaller工具:https://github.com/pyinstaller/pyinstaller

 Python 打包工具对比

python文件读写,以后就用with open语句

Python str() 函数

 Python字符串(Str)详解

Python--关于dict

  使用dict和set

8 a, b = b, a+b

# 这种赋值,先计算等值右边 那么 b=1 a+b=1

# 再赋值给a和b,那么 a=1, b=1

python下变和内存

实例:using_sys.py

#!/usr/bin/python
#Filename:using_sys.py
#python using_sys.py we are
import sys
import os
print 'the command line:'

"""
print 'hello'
"""

def test_main():
    print "we are in %s"%__name__

if __name__=="__main__":
    test_main()

print __file__

for i in sys.argv:
    print i#

print '\n\n PythonPath is',sys.path,'\n'

#fibonacci数列
a,b = 0,1
while b<10:
    print(b),
    a,b=b,a+b
print"\n"

#fibonacci数列
a=1
b=1
c=0
while c<30:
    c=a+b
    a=b
    b=c
    print(c)

#reverse
def reverse(str):
    str=str[::-1]

直接运行: python using_sys.py

生成二进制文件using_sys:

cd PyInstaller.py-2.1/

./pyinstaller.py ../romBuild.py

./pyinstaller.py -F ../romBuid.py  其中:-F表示生成文件;

./pyinstaller.py -F ../src/using_sys.py

cd PyInstalller-2.1/using_sys/dist/   - - - 生成文件目录,using_sys/dist是以using_sys.py的文件名命名的目录

./using_sys

10 Python在什么时候会生成pyc文件

【常用命令】

1 退出:
      1:输入exit(),回车
      2:输入quit(),回车

      3:输入ctrl+z,回车

python -m  执行py文件

    python setup.py install  安装Python包

python 环境变量设置PYTHONPATH --普通用户设置;

export PYTHONPATH=$PYTHONPATH:/home/xx/tools/python/lib/xxx;

python setup.py install --prefix=/home/xx/tools/python;

export PATH=$PATH:/home/xx/tools/python/bin

Python3、setuptools、Pip3安装详解

安装setuptools和pip

python pip的一些用法

python学习计划大全

Tornado(一) 安装及Demo

python IDE :Eclipse with PyDev

在Eclipse中搭建Python开发环境

spider:

domain.py

1>import urlparse  2>urlparse.urlparse

link_finder.py:1 >import HTMLParser  2>import urlparse  3>class LinkFinder<HTMLParser.HTMLParser>

4>super(LinkFinder,self) 5 urlparse.urljoin

main.py:1>import Queue  2>queue=Queue.Queue()

spider.py:1>from urllib2 import urlopen

5 spider.py: reponse=urlopen()   reponse.info().getheader()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值