
Lv.1
三年不鸣则已,一鸣惊人,三年不飞则已,一飞冲天!
签名:非常会弹钢琴,正在备战演奏文凭级,比较精通音律,配乐方面都可以找我
在 【Python作品分享】爬取网页源代码【H喵L】【作业帖】 中回复
import requests,easygui
A = easygui.enterbox('输入需要爬取源代码的网站','爬取信息')
if ((A in "https://") or (A in "http://")):
pachong_1 = requests.get(A)
elif((A in "edge://") or (A in "chorme://")):
if easygui.ynbox('这个网站可能跟浏览器有关。如果爬取,可能会损坏浏览器。确定继续?','爬取信息',('确定爬取','结束爬取')):
pachong_1 = requests.get(A)
else:
if(easygui.ynbox('网站是否采用了https协议?','爬取信息',('已采用','未采用'))):
pachong_1 = requests.get("https://" + A)
A = "https://" + A
else:
pachong_1 = requests.get("http://" + A)
A = "http://" + A
if A != None:
pachong_2 = pachong_1.text
easygui.msgbox(pachong_2,'爬取信息-' + A,'结束')2022-09-17T15:00:40 点赞:0
在 【震惊全站!】时隔两年!全站最丝滑的射击模拟迎来第一次重大更新!!! 中回复
async function poll(fn, msg) {//无限轮询执行sql语句直到成功
while (true) {
try {
return await fn()//一旦成功执行, 停止无限轮询, 并返回查询结果
} catch (e) {
const m = e.message//需要简略显示的异常消息
//sql偶尔会执行超时, 但如果反复显示timeout 15秒以上一直不停, 大概是数据库出了故障只能等官方修复
if (m.includes('timeout')) {
world.say(m)
}
else {
world.say(msg || e.stack)//如果sql执行出错, 广播错误消息, 用来排查错误原因
}
}
await sleep(2000) //每2秒重试一次
}
}
poll(initTable, '等待pg数据库启动中...')
world.onPlayerJoin(async ({ entity }) => {
//初始化玩家属性
entity.exp = 0
entity.coin = 50
entity.item = ['剑', '盾']
await loadUser(entity)//尝试读取存档
entity.onVoxelContact(() => {//每走1格增加1经验
entity.exp += 1
})
entity.player.onPress(async ({ button }) => {//右键显示状态栏
if (button == Box3ButtonType.ACTION1) {
const sel = await entity.player.dialog({
type: Box3DialogType.SELECT,
content: `
金币:${entity.coin}
经验:${entity.exp}
道具:[${entity.item}]
`,
options: ['保存','删档','游玩端数据','编辑端数据'],
})
if (sel) {
if (sel.value == '保存') {
await saveUser(entity)
entity.player.directMessage('保存完毕')
}
else if (sel.value == '删档') {
await deleteUser(entity)
entity.player.directMessage('删档完毕')
}
else if (sel.value == '游玩端数据') {
await showAllPlaySideUser()
}
else if (sel.value == '编辑端数据') {
await showAllEditSideUser()
}
}
}
})
})2022-11-06T11:05:53 点赞:0
在 【震惊全站!】时隔两年!全站最丝滑的射击模拟迎来第一次重大更新!!! 中回复
async function poll(fn, msg) {//无限轮询执行sql语句直到成功
while (true) {
try {
return await fn()//一旦成功执行, 停止无限轮询, 并返回查询结果
} catch (e) {
const m = e.message//需要简略显示的异常消息
//sql偶尔会执行超时, 但如果反复显示timeout 15秒以上一直不停, 大概是数据库出了故障只能等官方修复
if (m.includes('timeout')) {
world.say(m)
}
else {
world.say(msg || e.stack)//如果sql执行出错, 广播错误消息, 用来排查错误原因
}
}
await sleep(2000) //每2秒重试一次
}
}
poll(initTable, '等待pg数据库启动中...')
world.onPlayerJoin(async ({ entity }) => {
//初始化玩家属性
entity.exp = 0
entity.coin = 50
entity.item = ['剑', '盾']
await loadUser(entity)//尝试读取存档
entity.onVoxelContact(() => {//每走1格增加1经验
entity.exp += 1
})
entity.player.onPress(async ({ button }) => {//右键显示状态栏
if (button == Box3ButtonType.ACTION1) {
const sel = await entity.player.dialog({
type: Box3DialogType.SELECT,
content: `
金币:${entity.coin}
经验:${entity.exp}
道具:[${entity.item}]
`,
options: ['保存','删档','游玩端数据','编辑端数据'],
})
if (sel) {
if (sel.value == '保存') {
await saveUser(entity)
entity.player.directMessage('保存完毕')
}
else if (sel.value == '删档') {
await deleteUser(entity)
entity.player.directMessage('删档完毕')
}
else if (sel.value == '游玩端数据') {
await showAllPlaySideUser()
}
else if (sel.value == '编辑端数据') {
await showAllEditSideUser()
}
}
}
})
})
async function poll(fn, msg) {//无限轮询执行sql语句直到成功
while (true) {
try {
return await fn()//一旦成功执行, 停止无限轮询, 并返回查询结果
} catch (e) {
const m = e.message//需要简略显示的异常消息
//sql偶尔会执行超时, 但如果反复显示timeout 15秒以上一直不停, 大概是数据库出了故障只能等官方修复
if (m.includes('timeout')) {
world.say(m)
}
else {
world.say(msg || e.stack)//如果sql执行出错, 广播错误消息, 用来排查错误原因
}
}
await sleep(2000) //每2秒重试一次
}
}
poll(initTable, '等待pg数据库启动中...')
world.onPlayerJoin(async ({ entity }) => {
//初始化玩家属性
entity.exp = 0
entity.coin = 50
entity.item = ['剑', '盾']
await loadUser(entity)//尝试读取存档
entity.onVoxelContact(() => {//每走1格增加1经验
entity.exp += 1
})
entity.player.onPress(async ({ button }) => {//右键显示状态栏
if (button == Box3ButtonType.ACTION1) {
const sel = await entity.player.dialog({
type: Box3DialogType.SELECT,
content: `
金币:${entity.coin}
经验:${entity.exp}
道具:[${entity.item}]
`,
options: ['保存','删档','游玩端数据','编辑端数据'],
})
if (sel) {
if (sel.value == '保存') {
await saveUser(entity)
entity.player.directMessage('保存完毕')
}
else if (sel.value == '删档') {
await deleteUser(entity)
entity.player.directMessage('删档完毕')
}
else if (sel.value == '游玩端数据') {
await showAllPlaySideUser()
}
else if (sel.value == '编辑端数据') {
await showAllEditSideUser()
}
}
}
})
})
async function poll(fn, msg) {//无限轮询执行sql语句直到成功
while (true) {
try {
return await fn()//一旦成功执行, 停止无限轮询, 并返回查询结果
} catch (e) {
const m = e.message//需要简略显示的异常消息
//sql偶尔会执行超时, 但如果反复显示timeout 15秒以上一直不停, 大概是数据库出了故障只能等官方修复
if (m.includes('timeout')) {
world.say(m)
}
else {
world.say(msg || e.stack)//如果sql执行出错, 广播错误消息, 用来排查错误原因
}
}
await sleep(2000) //每2秒重试一次
}
}
poll(initTable, '等待pg数据库启动中...')
world.onPlayerJoin(async ({ entity }) => {
//初始化玩家属性
entity.exp = 0
entity.coin = 50
entity.item = ['剑', '盾']
await loadUser(entity)//尝试读取存档
entity.onVoxelContact(() => {//每走1格增加1经验
entity.exp += 1
})
entity.player.onPress(async ({ button }) => {//右键显示状态栏
if (button == Box3ButtonType.ACTION1) {
const sel = await entity.player.dialog({
type: Box3DialogType.SELECT,
content: `
金币:${entity.coin}
经验:${entity.exp}
道具:[${entity.item}]
`,
options: ['保存','删档','游玩端数据','编辑端数据'],
})
if (sel) {
if (sel.value == '保存') {
await saveUser(entity)
entity.player.directMessage('保存完毕')
}
else if (sel.value == '删档') {
await deleteUser(entity)
entity.player.directMessage('删档完毕')
}
else if (sel.value == '游玩端数据') {
await showAllPlaySideUser()
}
else if (sel.value == '编辑端数据') {
await showAllEditSideUser()
}
}
}
})
})
async function poll(fn, msg) {//无限轮询执行sql语句直到成功 while (true) { try { return await fn()//一旦成功执行, 停止无限轮询, 并返回查询结果 } catch (e) { const m = e.message//需要简略显示的异常消息 //sql偶尔会执行超时, 但如果反复显示timeout 15秒以上一直不停, 大概是数据库出了故障只能等官方修复 if (m.includes('timeout')) { world.say(m) } else { world.say(msg || e.stack)//如果sql执行出错, 广播错误消息, 用来排查错误原因 } } await sleep(2000) //每2秒重试一次 } } poll(initTable, '等待pg数据库启动中...') world.onPlayerJoin(async ({ entity }) => { //初始化玩家属性 entity.exp = 0 entity.coin = 50 entity.item = ['剑', '盾'] await loadUser(entity)//尝试读取存档 entity.onVoxelContact(() => {//每走1格增加1经验 entity.exp += 1 }) entity.player.onPress(async ({ button }) => {//右键显示状态栏 if (button == Box3ButtonType.ACTION1) { const sel = await entity.player.dialog({ type: Box3DialogType.SELECT, content: ` 金币:${entity.coin} 经验:${entity.exp} 道具:[${entity.item}] `, options: ['保存','删档','游玩端数据','编辑端数据'], }) if (sel) { if (sel.value == '保存') { await saveUser(entity) entity.player.directMessage('保存完毕') } else if (sel.value == '删档') { await deleteUser(entity) entity.player.directMessage('删档完毕') } else if (sel.value == '游玩端数据') { await showAllPlaySideUser() } else if (sel.value == '编辑端数据') { await showAllEditSideUser() } } } }) })
async function poll(fn, msg) {//无限轮询执行sql语句直到成功 while (true) { try { return await fn()//一旦成功执行, 停止无限轮询, 并返回查询结果 } catch (e) { const m = e.message//需要简略显示的异常消息 //sql偶尔会执行超时, 但如果反复显示timeout 15秒以上一直不停, 大概是数据库出了故障只能等官方修复 if (m.includes('timeout')) { world.say(m) } else { world.say(msg || e.stack)//如果sql执行出错, 广播错误消息, 用来排查错误原因 } } await sleep(2000) //每2秒重试一次 } } poll(initTable, '等待pg数据库启动中...') world.onPlayerJoin(async ({ entity }) => { //初始化玩家属性 entity.exp = 0 entity.coin = 50 entity.item = ['剑', '盾'] await loadUser(entity)//尝试读取存档 entity.onVoxelContact(() => {//每走1格增加1经验 entity.exp += 1 }) entity.player.onPress(async ({ button }) => {//右键显示状态栏 if (button == Box3ButtonType.ACTION1) { const sel = await entity.player.dialog({ type: Box3DialogType.SELECT, content: ` 金币:${entity.coin} 经验:${entity.exp} 道具:[${entity.item}] `, options: ['保存','删档','游玩端数据','编辑端数据'], }) if (sel) { if (sel.value == '保存') { await saveUser(entity) entity.player.directMessage('保存完毕') } else if (sel.value == '删档') { await deleteUser(entity) entity.player.directMessage('删档完毕') } else if (sel.value == '游玩端数据') { await showAllPlaySideUser() } else if (sel.value == '编辑端数据') { await showAllEditSideUser() } } } }) })2022-11-06T11:06:02 点赞:0
在 真 神 奇(F12离开我!) 中回复
<font color="#3399ff">b</font><font color="#41a0ec">u</font><font color="#4fa8da">4</font><font color="#5eb0c8">0</font><font color="#6cb8b6">免</font><font color="#7bc0a4">费</font><font color="#89c892">提</font><font color="#98cf80">供</font><font color="#a6d76e">有</font><font color="#b5df5c">用</font><font color="#c3e74a">的</font><font color="#d2ef38">工</font><font color="#e0f726">具</font>
2022-11-10T19:19:04 点赞:0