主要内容:文件的概念、文件类型、文件的读写操作。 例11-1:从键盘输入一些字符,逐个把它们送到磁盘上去,直到输入一个“#”为止。 #include #include void main() { FILE *fp; char ch , filename[10]; scanf("%s“, filename); if((fp=fopen(filename,"w"))==NULL) ...
fromsysimportstdout filename=input('输入文件名:\n') fp=open(filename,"w") ch=input('输入字符串:\n') whilech !='#': fp.write(ch) stdout.write(ch) ch=raw_input('') fp.close()
\n"); return ; } while((ch=getchar())!='#') { fputc(ch,fp); putchar(ch); } printf("\n"); fclose(fp);}
从键盘输入一些字符,逐个把它们写到磁盘文件"test1.txt"上,直到输入一个#为止我的代码:asd=open('test1','w')string=input('请输入字符串:\n')while (string!='#'): asd.write(string)asd=open('test1','r')print(asd.read())asd.close()结束不了输入状态,问题出在哪啊 求大佬来给看看问题啊! 还...
从键盘输入一些字符,逐个把它们写到磁盘文件上,直到输入一个 # 为止。 fp = open(F:\\123.txt,w) ch = input( 输入字符串 :\n) while ch != #: ch = input() fp = open(F:\\123.txt,r) line = fp.read() print( 文件内容: ,line) fp.close()的答案是什么.用刷刷题APP,拍照搜