网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
file=open('users/yourname/desktop/file','w')file.write('helloworld!')这句代码的作用是()。

A.打开一个文件,不管文件在不在

B.打开文件并写入

C.在桌面上打开一个文件(路径得看个人具体情况),w的意思是,如果有则在文件里写入helloworld,如果没有则创建一个文件。

D.打开文件,没有报错


参考答案

更多 “ file=open('users/yourname/desktop/file','w')file.write('helloworld!')这句代码的作用是()。 A.打开一个文件,不管文件在不在B.打开文件并写入C.在桌面上打开一个文件(路径得看个人具体情况),w的意思是,如果有则在文件里写入helloworld,如果没有则创建一个文件。D.打开文件,没有报错 ” 相关考题
考题 要打开一个已存在的非空文件“file”用于修改,选择正确的语句() A、fp=fopen(“file“,“r“);B、fp=fopen(“file“,“w“);C、fp=fopen(“file“,“r+“);D、fp=fopen(“file“,“w+“);

考题 ( 16 )要建立文件流并打开当前目录下的文件 file.dat 用于输入,下列语句中错误的是A ) ifstream fin=ifstream.open ( "file.dat" ) ;B ) ifstream*fir.=new ifstream ( "file.dat" ) ;C ) ifstream fin; fin.open ( "file.dat" ) ;D ) ifstream *fin=new ifstream ( ) ; fin 一 open ( "file.dat" ) ;

考题 下面哪种方法读文件“input.txt”是正确的()。 A、in_file = open('input.txt','w')B、in_file = open('input.txt',r)C、in_file = open('input.txt','r')D、都不正确

考题 要对顺序文件进行写操作,下列打开文件语句中正确的是______。A.Open"file1.txt" for Output As #1B.Open "file1.txt" for Input As #1C.Open "file1. txt" for Random As #1D.Open "file1. tx",for Binary As #1

考题 要建立文件流并打开当前目录下的文件file.dat用于输入,下列语句中错误的是A.ifstream fin=ifstream.open(”file.dat”);B.ifstream*fin=new ifstream(”file.dat”);C.ifstream fin;fin.open(”file.dat”);D.ifstream*fin=new ifstream();fin-open(”file.dat”);

考题 要建立文件流并打开当前目录下的文件6le.dat用于输入,下列语句中错误的是( )。A.ifstream fin=ffstream.open(”file.dat”);B.ifstream*fin=new ifstream(”file.dat”);C.ifstream fin;fin.open(”file.dat”);D.ifstream*fin=new ifstream;fin-open(”file.dat”);

考题 下列可以打开随机文件的语句是( )。A.Open"file 1.dat"For Input As#1B.Open"file1.dat"For Append As#1C.Open"file1.dat"For Output As#1D.Open"file1.dat"For Randow As#1 Len=20

考题 在C中,打开文件的程序段中正确的是A.#include <stdio.h> FILE *fp; fp=fopen("file1.c","WB");B.#include <stdio.h> FILE fp; fp=fopen("file1.c","w");C.#include <stdio.h> FILE *fp; fp=fopen("file1.c","w");D.#include <string.h> FILE *fp; fp=fopen("file1.c","w");

考题 下面程序代码打开了一个二进制文件。 …… ifstream file3; …… file3.open("abc.bmp", );