标签 python 下的文章

来自 https://eqblog.com/centos-install-python3-6-4.html
1.获取编译包:

wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz

2.解压:

tar -zxvf Python-3.6.4.tgz

3.移动到安装目录

mv Python-3.6.4 /usr/local

4.进入目录:

cd /usr/local/Python-3.6.4

5.编译安装:

./configure
make
make install

6.软链接:

ln -s /usr/local/bin/python3.6 /usr/bin/python3

大功告成:

python3 -V

以下来自 https://eqblog.com/whmcs-python-hon.html
http://www.hostloc.com/thread-422346-1-1.html
安装Python3 使用python3 x.py

#本脚本基于python3+方糖实现enoctus监控+微信推送
#使用方法:
#修改 sckey 为你自己的方糖KEY
#修改 pid 为你想要监控的套餐PID
#python vps.py
#香港1G pid=93


from sys import argv
from urllib import request,parse
from os import system
import datetime
sckey="xxxxxx"
pid=93

url='https://einstein.enoctus.co.uk/cart.php?a=add&pid=%s' % (pid)
try:
    flag=0
    oktime=datetime.datetime.now()
    oktime.strftime('%Y-%m-%d %H:%M:%S')
    outoftime=datetime.datetime.now()
    outoftime.strftime('%Y-%m-%d %H:%M:%S')
    while True:
        header={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36'}
        req=request.Request(url,headers=header)
        page=request.urlopen(req).read()
        if str(page).find('out of stock')>0:
            if flag>0:
                outoftime=datetime.datetime.now()
                outoftime.strftime('%Y-%m-%d %H:%M:%S')
                timeout='本轮次上货持续时间:%s' % (outoftime-oktime)
                print(timeout)
                tile='%s%s' % ('缺货提醒',timeout)
                textmod={'text':tile,'desp':url}
                textmod = parse.urlencode(textmod)
                urlsc='https://sc.ftqq.com/%s.send' % (sckey)
                req1=request.Request(url='%s%s%s' % (urlsc,'?',textmod),headers=header)
                page1=request.urlopen(req1).read()
            flag=0
            print('缺货')
        else:
            if flag==0:
                oktime=datetime.datetime.now()
                oktime.strftime('%Y-%m-%d %H:%M:%S')
                timeok='本轮缺货持续时间:%s' % (oktime-outoftime)
                print(timeok)
                tile='%s%s' % ('上货提醒',timeok)
                textmod={'text':tile,'desp':url}
                textmod = parse.urlencode(textmod)
                urlsc='https://sc.ftqq.com/%s.send' % (sckey)
                req1=request.Request(url='%s%s%s' % (urlsc,'?',textmod),headers=header)
                page1=request.urlopen(req1).read()
            flag=flag+1
            print('有货')
            if flag<3:
                tile='%s%s' % ('上货提醒',flag)
                textmod={'text':tile,'desp':url}
                textmod = parse.urlencode(textmod)
                urlsc='https://sc.ftqq.com/%s.send' % (sckey)
                req1=request.Request(url='%s%s%s' % (urlsc,'?',textmod),headers=header)
                page1=request.urlopen(req1).read()
except:
    print('脚本异常,退出')


先去 https://www.liaoxuefeng.com/ 过一遍。
然后官方文档 细看一边 https://docs.python.org/zh-cn/3.6/tutorial/index.html
最后去找实战视频或者教程

Python 的练手项目有哪些值得推荐?
Python 练习册,每天一个小程序 https://github.com/Show-Me-the-Code/python
Python 练习册,每天一个小程序

Python3 教程

Python3入门笔记(1) —— windows安装与运行
一行代码结果叹为观止,能做到这么极致的也只有Python了

https://www.tutorialdocs.com/tutorial/python3/home.html

https://zhuanlan.zhihu.com/p/39812581
3小时Python入门

https://learnpythonthehardway.org/
https://github.com/CodementorIO/Python-Learning-Resources
https://github.com/xjr7670/QQzone_crawler

python -m SimpleHTTPServer
python -m SimpleHTTPServer 8080 # python2
python3 -m http.server 8080 # python3


Django

Django 2.0 中文官方文档地址:
https://docs.djangoproject.com/zh-hans/2.0/

Django Girls 教程
https://tutorial.djangogirls.org/zh/

https://pythonclock.org/

Crossin编程教室


Python下缩进以空格键实现,4个空格一个缩进
但有些人是使用了Tab键来进行缩进!!!错误原因所在