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

【常用命令】

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的一些用法

Tornado(一) 安装及Demo

猜你喜欢

转载自blog.csdn.net/eleven_xiy/article/details/77962014
今日推荐