当前位置: 首页 > news >正文

网站建设推广工资怎么自己做网站吗

网站建设推广工资,怎么自己做网站吗,怎么做游戏门户网站,小程序api手册#codingutf-8 ‘‘‘脚本说明 用来解决csv文件的列异常问题#xff08;以逗号分隔符为例#xff09;#xff1a; csv文件有些列含有换行符、逗号等特殊符号#xff0c;这就导致csv文件出现列异常的情况。 此脚本将csv文件输出成如下文件#xff1a;源文件名-正确列-文件序…#codingutf-8 ‘‘‘脚本说明 用来解决csv文件的列异常问题以逗号分隔符为例 csv文件有些列含有换行符、逗号等特殊符号这就导致csv文件出现列异常的情况。 此脚本将csv文件输出成如下文件源文件名-正确列-文件序号.csv 源文件名-错误列.csv 源文件名-info.txt 常用文本编码 gbk,gb2312,utf-8,utf-8_sig ★因为没有实现文本编码转换所以“输入文件编码”和“输出文件编码”要写成一致才行其中输入文件编码必须正确 不知道为什么有些gbk输入文件会报错 for count,line in enumerate(open(fileNamefileExt,‘rU‘,encodinginFileEncoding)): UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xf8 in position 5902: illegal multibyte sequence 解决办法 使用powershell转换格式成utf-8然后在使用本脚本来处理。其中powershell转换格式的代码如下 Get-Content -path .\2014.csv|Out-File .\2014-1.csv -Encoding utf-8‘‘‘ #单行注释 ‘‘‘多行注释 取模运算 if a % b 0 : print ‘yes‘ else: print ‘no‘ 整除语法: 2//1‘‘‘ importos,csv,sys fileName‘2013-1‘fileExt‘.csv‘ #输入文件编码 inFileEncoding‘utf-8‘ #输出文件编码 outFileEncoding‘utf-8‘ #行号 rowscount1 #分隔符号 delimiterChar‘,‘rowLength0#分割后文件名开始编号 filecount0#计算文件总行数 count-1 for count,line in enumerate(open(fileNamefileExt,‘rU‘,encodinginFileEncoding)):passcount 1 #源文件名-info.txt filename3fileName‘-info‘‘.txt‘file3open(filename3,‘w‘,encoding‘utf-8‘) statinfoos.stat(fileNamefileExt)print(\n文件名称 fileNamefileExt)print(\n文件名称 fileNamefileExt,filefile3 )print(文件行数str(count) )print(文件行数 str(count),filefile3 )print(文件大小 str(statinfo.st_size//1024//1024)M)print(文件大小 str(statinfo.st_size//1024//1024)M,filefile3) strContentInputinput(请输入要分割成的文件数:)ifstrContentInput.isdigit(): contentInputint(strContentInput)else:print(★ 您输入的strContentInput不是数字 !,filesys.stderr)print(★ 您输入的strContentInput不是数字 !,filefile3)#退出脚本 sys.exit()print(分割成的文件数strContentInput)print(分割成的文件数strContentInput,filefile3) splitLineCountcount//contentInputprint(每文件行数str(splitLineCount))print(每文件行数str(splitLineCount),filefile3)#可以用一个list包含文件对象列表#源文件名-正确列-文件序号.csv fileList[] fileIndex0print(分割后的文件名)print(分割后的文件名,filefile3)while fileIndex filetmpnamefileName‘-正确列-‘str(fileIndex)fileExtprint( filetmpname)print( filetmpname,filefile3) filetmpopen(filetmpname,‘w‘,encodingoutFileEncoding) fileList.append(filetmp) fileIndexfileIndex1 #源文件名-错误列.csv filename2fileName‘-错误列‘fileExt file2open(filename2,‘w‘,encodingoutFileEncoding)print(分割后的文件名列异常数据)print(分割后的文件名列异常数据,filefile3)print( filename2)print( filename2,filefile3) with open(fileName‘.csv‘,newline‘‘,encodinginFileEncoding) as csvfile: spamreadercsv.reader(csvfile,delimiterdelimiterChar)for line inspamreader:#列数为0时读取第一行作为准确的列数。 if ( rowLength 0 ): rowLengthlen(line)#列数不为0时当前行的列数与其匹配将匹配的和不匹配的保存到不同的文件。 else:if ( rowLength len(line) ):#输出到对应文件序号的文件中 行数“整除”分割行数 if ( rowscount//splitLineCount len(fileList)-1):print((‘,‘.join(line)),filefileList[len(fileList)-1])else:print((‘,‘.join(line)),filefileList[rowscount//splitLineCount])else:print((‘,‘.join(line)),filefile2) rowscountrowscount1 #关闭文件 file2.close()delfile2 file3.close()delfile3 fileIndex0while fileIndex fileList[fileIndex].close() fileIndexfileIndex1 #删除整个fileList del fileList
http://www.zqtcl.cn/news/727790/

相关文章:

  • 中国建设银行官网的网站首页c2c电子商务网站建设栏目结构图
  • 做网站的软件图标上海建站外贸
  • 保定网站建设推广成都移动端网站建设
  • 服务平台型网站做那个网站比较好
  • 网站做icp备案需要多久上海人才引进官网
  • 国外的设计网站app有什么好的免费网站做教育宣传语
  • 做期货都看那些网站淮北网
  • 网站建设的需求怎么写网站头条怎么做
  • 宜春seoseo网站自动推广
  • 张家界酒店网站建设人人设计网网址
  • 电脑系统做的好的网站什么网站做一手房好
  • 为什么用MyEclipse做网站上海境外输入
  • 做的比较好的小众网站go 是做网站的吗
  • 手机网站快速建设网站接入支付宝需要网站备案吗
  • 贵州省住房城乡建设厅网站农业营销型网站源码
  • 网站开发使用哪种语言wordpress 免费主机
  • 山东免费网站制作绿色食品网站模板
  • 做搜狗网站优化点广州网站开发人
  • 网站建设违法行为广东seo快速排名
  • 体育彩票网站开发该做哪些步骤深圳网站建设策划方案
  • 金华网站建设电话做网站用虚拟机还是服务器
  • 整容医院网站建设目的顺企网贵阳网站建设
  • 微网站 htmlseo做的好的网站
  • 免费做网站推荐东平网页设计
  • 所有复刻手表网站wordpress 标题简码
  • 云南建设厅建设网站首页网站建设s
  • 网站用户需求报告网站充值怎么做的
  • 找代码的网站有一个网站是做釆购的是什么网
  • 做外贸最好的网站有哪些php网站开发工程师待遇
  • 做推文封面的网站首页>新闻>正文 网站怎么做