Python文件基本操作
来源:互联网 发布:蜀国只有一个州 知乎 编辑:程序博客网 时间:2024/06/03 07:17
#随机生成1000个数,并写入文件,每行十个数字;打开读取文件内容,并求出其中的最大值,和所在的位置。import randomfile=open("text.txt","w")num=[]i=0col=0max=-1hang=0lie=0while i<1000: i+=1 num.append(random.randint(1,1000))#print(num)for r in num: col+=1 file.write(str(r) + "\t") if (col)%10==0: file.write("\n") #file.write("\t")file.close()file=open("text.txt","r")for line in file: hang+=1 lie=0 line=line.split() for i in line: lie+=1 if i>max: max=i maxhang=hang maxlie=lieprint(maxhang)print(maxlie)print(max)
- Python文件基本操作
- python基本文件操作
- Python 文件基本操作
- Python 文件基本操作
- Python文件基本操作
- Python基本文件操作
- python读写文件基本操作
- Python基础--基本文件操作
- Python 中的基本文件操作
- 小白学Python(二) 基本文件操作
- python对文件的基本操作
- python文件路径的基本操作
- Python基础--基本文件操作二
- Python学习笔记之:文件基本操作
- Python零碎知识(3):对文件的基本操作
- python对文件的几大基本操作
- Python基本语法_文件操作_读写函数详解
- Python 基本类型操作
- Linux-iptables配置-防火墙配置
- 单片机数码管时钟显示
- kernel32基地址获得学习笔记
- ACM算法题——快捷键的难题
- MySQL存入时间只有年月日
- Python文件基本操作
- uva 11151 Longest Palindrome(LCS)
- 同步和异步的区别
- Android的logcat命令详解
- win7 64位系统搭建android开发环境
- dede分页标签惹的祸:pagebreak中的的方法
- C语言中 sscanf 的用法
- C语言为二维数组动态分配内存的问题
- 编程比较两棵二叉树是否相等