Python read打印与print区别

read()输出文件本来内容,包括tab、空格、换行符

print(), 则首先显示内容行数,然后将转义字符转义打印输出

fd=open(r'F:\data\edges.txt','r')
fd.read(1024)

'0\t5\n0\t6\n0\t7\n0\t8\n0\t9\n0\t10\n0\t11\n0\t12\n0\t13\n0\t14\n0\t15\n0\t16\n0\t17\n0\t18\n0\t19\n0\t20\n0\t21\n0\t22\n0\t23\n0\t24\n0\t25\n0\t26\n0\t27\n0\t28\n0\t29\n0\t30\n0\t31\n0\t32\n0\t33\n0\t34\n0\t35\n0\t36\n0\t37\n0\t38\n0\t39\n0\t40\n0\t41\n0\t42\n0\t43\n0\t45\n0\t46\n0\t47\n0\t48\n0\t49\n0\t50\n0\t51\n0\t52\n0\t53\n0\t54\n0\t55\n0\t56\n0\t57\n0\t58\n0\t59\n0\t60\n0\t61\n0\t62\n0\t63\'

teststr=fd.read(1024)
print teststr

61
2       162
2       163
2       164
2       165
2       166
2       167
2       168
2       169
2       170
2       171
2       172


                                    
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客
应支付0元
点击重新获取
扫码支付

支付成功即可阅读