积极回复
sadsadasdsadsadasd
>>> resultFile = open('e:\\temp\\OpenMe.txt','w')
>>> for each in f:
resultFile.write(each)
没有鱼币,蛋疼得
感谢小甲鱼老师
学习中 狗狗狗
热爱鱼C
支持
谢谢
这个好
。。。。。。。。。。。
很有帮助
哈哈哈哈
def find_eachline(str,character):
lis = str.split(character)
num = len(lis) - 1
return num
def find_all(file,character):
f = open(file)
flag = 0
for eachline in f:
n = find_eachline(eachline,character)
flag += n
f.close()
return flag
def all_replace(file,old,new):
n = find_all(file,old)
f = open(file)
print("There are %d %s"%(n,old))
choice = input("Are you sure to replace %s with %s 【Y/N】?"%(old,new))
temp = []
if choice == 'Y':
for eachline in f:
temp.append(eachline.replace(old,new))
f.close()
f = open(file,'w')
f.writelines(temp)
f.close()
file = input("Please enter filename: ")
old = input("Please enter the characters will be replaced: ")
new = input("Please enter the new character: ")
all_replace(file,old,new)
谢谢小甲鱼老师分享
f.truncate()怎么用?
111
支持甲鱼老师!
0.将列表 字典 集合等转为二进制存储 然后再调用?
1.pickle.dump()
2.pickle.load()
3.可以
0. # 遇到多个等号来分割应该怎么搞
#
def hanshu():
import pickle
count=1
boy_count=[]
girl_count=[]
f=open(C:\Users\pokemon\Desktop\record.txt,'wb')
for each in f:
(person,content) =each.split(:)#正确的分割形式是怎样的?...
if person == 小甲鱼:
boy_count.append(content)
if person == 小客服:
girl_count.append(content)
count+=1
f1=open(D://下载//boy_count.txt.'w+')
f2=open(D://下载//girl_count.txt.'w+')
if each ==
谢谢版主分享!!!