首页
›
答案
›
题库
›
远程教育
›
联大学堂
编写程序,在D盘根目录下创建一个文本文件test.txt,并向其中写入字符串helloworld。
编写程序,在D盘根目录下创建一个文本文件test.txt,并向其中写入字符串helloworld。
正确答案:fp=open(r’D:\test.txt’,‘a+’)print(‘helloworld’,file=fp)fp.close()
标签:
计算机科学与技术
Python语言程序设计
字符串
上一条:
阅读下面的代码,解释其功能。>>>importstring>>>x=string.ascii()letters+string.digits>>>importrandom>>>print(.join(random.sample(x,10)))
下一条:
下面的代码是否能够正确运行,若不能请解释原因;若能,请分析其执行结果。>>>x=list(range(20))>>>foriinrange(len(x)):delx[i]