import os,csv
class storeCsv():
def __int__(self,path,name,content):
self.path=path
self.name=name
self.content=content
def _judge_(self,name):
if os.path.exists(name):
print('文件已存在')
else:
print('文件不存在')
def _write_(self,path,content):
fp=open(path,'a')
writer=csv.writer(fp)
writer.writerow((content))
fp.close()
test=storeCsv()
filename=input("请输入文件名字:")
test._judge_(filename)
filepath=input("请输入文件:")
filecontent=input("请输入内容:")
test._write_(filepath,filecontent)
【Python爬虫】第十二次作业
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- a='I ' b='like ' c='python' print(a+b+c) s=' sdghHhf ' s1...
- def test(n): x=int(n)//4*6 y=int(n)%4 if y==0: return x e...