Making py file and deleting currect py file("Python") | SoloLearn: Learn to code for FREE!

0

Making py file and deleting currect py file("Python")

I want to make a Program that will make: 1.a Folder(Called Test) at C:\users\username\Desktop\Test.dir 2.a program in Test.dir that will delete program that made it I am new at python so can you please say the easiest way possible I am using "Python 3"

1/20/2019 3:43:45 PM

Damjan Boxer

2 Answers

New Answer

+1

Creating a folder will be no problem. But I'm afraid you won't be able to create a file, run it and delete the file which started it all, since it will be opened during runtime. You can check out my code in Sololearn, which creates a new file, runs it and the run creates yet another file. It will work alright. But deleting an open file during runtime may fail: https://code.sololearn.com/c5f76DBYhYSO/?ref=app

0