Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
627 views
in Technique[技术] by (71.8m points)

python-3.x - 该代码在我的命令提示符下运行正常,但是我无法在spyder中执行该代码。 [关闭](This code is working perfectly in my command prompt,but i am unable to execute the code in spyder.Please help me with this? [closed])

from sys import argv

(从sys import argv)

script,filename=argv,'hello.txt'

(脚本,文件名= argv,“ hello.txt”)

print("we are going to erase the %r" % filename)

(print(“我们将要擦除??%r”%文件名))

print("If you dont wanna delete, press esc")

(打印(“如果您不想删除,请按esc键”))

input("?")`

(input(“?”)`)

target=open(filename,'w')

(target = open(文件名,'w'))

print("the filename is %r" % filename)

(print(“文件名是%r”%文件名))

print("let's delete the file contents")

(打印(“删除文件内容”))

target.truncate()

(target.truncate())

print("lets start writing all the 3 lines.")

(print(“让我们开始写所有三行。”))

line1=input("the first line is :")

(line1 = input(“第一行是:”))

line2=input("the second line is:")

(line2 = input(“第二行是:”))

line3=input("the third line is:")

(line3 = input(“第三行是:”))

print("I am going to write these lines.")

(打印(“我要写这些行。”))

target.write(line1)

(target.write(line1))

target.write("\n")

(target.write(“ \ n”))

target.write(line2)

(target.write(line2))

target.write("\n")

(target.write(“ \ n”))

target.write(line3)

(target.write(line3))

target.write("\n")

(target.write(“ \ n”))

print("We are closing the file")

(打印(“我们正在关闭文件”))

target.close()

(target.close())

  ask by Shivam Bhat translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...