python全栈学习1.开课介绍

python————web  && 爬虫

Django pyramid Tornado Bottle Flask

GUI图形开发 QT

想要类似于执行shell脚本一样执行python脚本,例: ./hello.py ,那么就需要在 hello.py 文件的头部指定解释器,如下:

#!/usr/bin/env python
  
print "hello,world"

——————P6——————2018.7.26

 以下关键字不能声明为变量名
['and','as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield']

输出是 可以用占位符进行格式化输出

也可以用format

print("{}ssss{}".format(str1,str2))

两个大括号表示普通的大括号,大括号了可以有数字,作为输入的索引顺序

输入密码时,如果想要不可见,需要利用getpass 模块中的 getpass方法,即:

import getpass# 将用户输入的内容赋值给 name 变量
pwd = getpass.getpass("请输入密码:")# 打印输入的内容
print(pwd)
 
while op:
else : 执行条件while正常走完结束执行else,如果中间break,return,是不会执行的
while还有这样的操作
同理for也是如此
 
对于range(起点,终点,步长)
 
import sys
 
print(sys.argv)————打印了相对路径
 sys.path ——打印环境变量
原文地址:https://www.cnblogs.com/DF-yimeng/p/9373838.html