吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1646|回复: 8
收起左侧

[求助] 一个简单的python程序加入循环

[复制链接]
独家记忆~ 发表于 2021-1-29 11:35
25吾爱币
运行程序,如果提示的信息不是您已经选了该门课程则进入循环每隔1秒执行该程序

import requests
import json

url = "https://"
payload = 'kcrwdm=1101474'
headers = {...}
data = requests.post(url, data=payload, headers=headers)
print(data.text)
微信截图_20210129113031.png

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

我没有失眠啊i 发表于 2021-1-29 11:35
[Python] 纯文本查看 复制代码
import requests
import json
import time

while True:
    url = "https://"
    payload = 'kcrwdm=1101474'
    headers = {...}
    data = requests.post(url, data=payload, headers=headers)
    print(data.text)
    if data.text != data.text:
        time.sleep(1)
    elif data.text == data.text:
        break
10373064 发表于 2021-1-29 11:40
 楼主| 独家记忆~ 发表于 2021-1-29 11:42
 楼主| 独家记忆~ 发表于 2021-1-29 11:51
我没有失眠啊i 发表于 2021-1-29 11:43
[mw_shl_code=python,true]import requests
import json
import time

IndentationError: unexpected indent
程序“python.exe”已退出,IndentationError: unexpected indent
程序“python.exe”已退出,返回值为 -1 (0xffffffff)。返回值为 -1 (0xffffffff)。
我没有失眠啊i 发表于 2021-1-29 11:54
本帖最后由 我没有失眠啊i 于 2021-1-29 11:55 编辑
独家记忆~ 发表于 2021-1-29 11:51
IndentationError: unexpected indent
程序“python.exe”已退出,IndentationError: unexpected indent ...

[Python] 纯文本查看 复制代码
import requests
import json
import time
 
while True:
    url = "https://"
    payload = 'kcrwdm=1101474'
    headers = {...}
    data = requests.post(url, data=payload, headers=headers)
    print(data.text)
    time.sleep(1)
    if data.text == ‘[font="]您已经选了这门课[/font]’:
        break
落寒枫 发表于 2021-1-29 11:54
我没有失眠啊i 发表于 2021-1-29 11:43
[mw_shl_code=python,true]import requests
import json
import time

if data.text != '您已经选了该门课程'

应该是这样吧

免费评分

参与人数 1吾爱币 +1 热心值 +1 收起 理由
独家记忆~ + 1 + 1 我很赞同!

查看全部评分

itcfan 发表于 2021-1-29 11:54
[Asm] 纯文本查看 复制代码
import requests
import json
import time

while True:
    url = "https://"
    payload = 'kcrwdm=1101474'
    headers = {...}
    data = requests.post(url, data=payload, headers=headers)
    print(data.text)
    if data.text != "您已经选了该门课程":
        break
    else:
        time.sleep(1)
Johan_000 发表于 2021-1-29 13:11
用re啊,你这个不是已经知道要匹配的文本内容了么,直接re做个判定就好了
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止回复与主题无关非技术内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-5-23 09:33

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表