猫史档案馆


wrmdcxy

wrmdcxy

Lv.1

还有bcm老用户吗 [编辑于2026年5月16日 15点53分]

获赞:69收藏:19浏览:755作品收藏:137

签名:作业作业作业作业作业作业作业作业作业作业作业作业作业作业作业作业作业作业作业作业浏览bcm作业作业作业作业作业作业作业作业作业作业作业作业

回复帖子评论
上一页4 页 / 共 29下一页

为什么有人认为我是黑客??? 中回复

要不要给个黑别人电脑的代码和步骤?

2020-03-02T12:40:13 点赞:0

能不能不要再刷屏了 中回复

center_image

center_image

center_image

我也是醉了……

2020-03-02T13:18:14 点赞:0

【Python作品分享】凯撒密码 中回复

你可以这样写

string = 'hh'
length = len(str)
str_temp = ''
for i in range(len):
    temp = ord(str[i])+2
    str_temp += chr(temp)
str = str_temp
print(str)

2020-03-02T13:57:30 点赞:0

python有什么翻译的库? 中回复

https://shequ.codemao.cn/community/239626

你看一下,肯定有启发

2020-03-02T18:44:14 点赞:1

python有什么翻译的库? 中回复

翻译的库:https://pypi.org/project/translate/

2020-03-02T18:45:16 点赞:1

【Python作品分享】Python Shell 中回复

纯英文版~

2020-03-03T10:17:28 点赞:0

【海龟编辑器】意见反馈信箱(长期有效) 中回复

对了龟龟,能不能取消自动格式……好烦啊

2020-03-03T20:54:04 点赞:0

我应该做些神马啊啊啊啊! 中回复

我的FileProcessing模块(都要变成库了)正在不断地扩张

center_image

2020-03-04T15:08:59 点赞:1

我应该做些神马啊啊啊啊! 中回复

我还搞了Errors库,内容就是提供其它类型的错误

center_image

2020-03-04T15:51:57 点赞:0

我应该做些神马啊啊啊啊! 中回复

代码:

def deleteLinesbyContents(path,contents,encoding='utf-8'):
    from Errors import FindError
    import time
    try:
        with open(path,'r',encoding=encoding) as file1:
            file=''
            for x in file1:
                file+=x
            lines=file.splitlines()
            lineNumber=1
            line='j'
            while line!='':
                line=file1.readline()
                print(line)
                time.sleep(3)
                if line==contents:
                    isFind=0
                    break
                elif line.strip()=='':
                    print('BlankLine')
                    continue
                else:
                    print(lineNumber)
                    lineNumber+=1
                    print(line=='')
                    time.sleep(3)
            try:
                isFind+=1
            except UnboundLocalError:
                file1.close()
                raise FindError('There is no "%s" in this file'%(str(contents)))
            del lines[lineNumber-1]
            file1.close()
        with open(path,'w',encoding=encoding) as file1:
            for x in lines:
                file1.write(str(x)+'\n')
            file1.close()
    except Exception as e:
        raise e

deleteLinesbyContents('F:\\ll.txt','DEl')

文件内容:

look!
There!
delete!
ready!
This is delete
go!
DEl
DEL
DEl!!!!

运行结果:

Traceback (most recent call last):
  File "G:\AllFunctions\FileProcessing.py", line 174, in <module>
    deleteLinesbyContents('F:\\ll.txt','DEl')
  File "G:\AllFunctions\FileProcessing.py", line 172, in deleteLinesbyContents
    raise e
  File "G:\AllFunctions\FileProcessing.py", line 144, in deleteLinesbyContents
    isFind
UnboundLocalError: local variable 'isFind' referenced before assignment

就这样,不要在意颜色

2020-03-04T16:49:47 点赞:0

我应该做些神马啊啊啊啊! 中回复

问题已解决,最终代码为:

def deleteLinesbyContents(path,contents,encoding='utf-8'):
	from Errors import FindError
	try:
		with open(path,'r',encoding=encoding) as file1:
			file=''
			for x in file1:
				file+=x
			lines=file.splitlines()
			lineNumber=1
			file1.seek(0,2)
			size=file1.tell()
			file1.seek(0,0)
			sizeNow=file1.tell()
			while sizeNow<size:
				line=(file1.readline()).strip()
				sizeNow=file1.tell()
				if line==contents:
					isFind=0
					break
				elif line.strip()=='':
					continue
				else:
					lineNumber+=1
			try:
				isFind+=1
			except UnboundLocalError:
				file1.close()
				raise FindError('There is no "%s" in this file'%(str(contents)))
			del lines[lineNumber-1]
			file1.close()
		with open(path,'w',encoding=encoding) as file1:
			for x in lines:
				file1.write(str(x)+'\n')
			file1.close()
	except Exception as e:
		raise e

deleteLinesbyContents('F:\\ll.txt','This is delete')

文件内容:

look!
There!
delete!
ready!
This is delete
go!
DEl
DEL
DEl!!!!

运行结果:

[Finished in 0.4s]

运行后文件内容:

look!
There!
delete!
ready!
go!
DEl
DEL
DEl!!!!

2020-03-04T17:02:38 点赞:0

如何建一堵墙让角色过不去 中回复

重复执行

    如果 碰到 墙

        移动 -(XX)

 

里面的“XX”是移动的步数(比如:

当   按下  按键<→>

    移动  (5)步

 

那么XX就是5)

2020-03-04T17:23:20 点赞:0

如何建一堵墙让角色过不去 中回复

再比如说:

center_image

2020-03-04T17:27:52 点赞:0

dalao请指导 中回复

这是捆绑软件……啊不,这是捆绑库吗…………

center_image

2020-03-05T11:55:15 点赞:0

dalao请指导 中回复

呃呃呃呃…………………………………………………………

center_image

center_image

 

center_image

2020-03-05T11:58:01 点赞:0

我应该做些神马啊啊啊啊! 中回复

晒日常——点名器开发中

center_image

2020-03-05T16:12:04 点赞:0

dalao请指导 中回复

呃呃呃呃………………

center_image

2020-03-05T18:35:10 点赞:0

【Python作品分享】网络延时测试模块【作品秀】 中回复

import os,sys


class Logger(object):
    def __init__(self):
        self.terminal = sys.stdout
        self.log = ''

    def write(self, message):
        self.terminal.write(message)
        self.log += message

    def flush(self):
        pass

    def __str__(self):
        return self.log



def getSystem(command):
    sys.stdout = Logger()
    file = sys.stdout
    os.system(str(command))
    return str(file).replace('\n', '')

system()返回值Get!

2020-03-06T16:07:56 点赞:0

求助贴:我代码是哪里没考虑到?移零这一题 中回复

我有的时候也是这样,应该是他认为一定要按照正确答案编写代码或认为代码不够简洁

2020-03-08T12:18:05 点赞:1

来来来,各位玩Python的都在评论区公布奇葩代码 中回复

a='hello world'
try:
    a+=1
except:
    try:
        exec('5=1')
    except:
        for x in range(30):
            a=a+','
            a=a+'hello world'
    finally:
        a=a.split(',')
b=''
for index in range(len(a)):
    b+=a[index]
c=b[:11]
print(c)

=>

hello world

2020-03-08T12:44:52 点赞:0

【Python作品分享】质数查找器【作品秀】 中回复

我怀疑你是用积木编的

2020-03-08T16:53:47 点赞:0

求助贴:我代码是哪里没考虑到?加减算式这一题 中回复

用eval()

2020-03-08T16:56:39 点赞:0

一波未平,一波又起!林克杯2开始啦! 中回复

我觉得林克杯不是考常识、基础,而是考误区、难点

2020-03-08T18:15:58 点赞:0

【小调查】 中回复

2~

2020-03-09T09:11:28 点赞:0

本人讲几句心里话(全当是开玩笑) 中回复

emotion_编程猫_点赞

2020-03-10T19:17:10 点赞:0

海龟编辑器python,等待代码怎么写 中回复

其实有很多种方法,关键看你用在哪里

2020-03-13T14:38:40 点赞:0

【Python作品分享】你好(派森版)【作品秀】 中回复

。。。。。。。。。。。。。。。。。。。。

2020-03-13T14:39:41 点赞:0

【Python作品分享】你好(海龟版)【作品秀】 中回复

。。。。。。。。。。。。。。。

2020-03-13T14:40:05 点赞:0

用Python开发你的第一款游戏(开源项目合集) 中回复

Python更适合用来做计算器,输入999**999,结果立马出来,一秒也不卡

输入9999**9999,只卡1秒

2020-03-13T14:42:31 点赞:0

【python作品秀】之前一直在写C++。没想到写了海龟编辑器,这么好玩 中回复

好玩就对了

2020-03-13T14:58:42 点赞:0