Question: [EC1-8] ( strip_comments.py ) Write a program that reads a string fname from the user, then opens the file fname.py (Python source) with that name.

[EC1-8] (strip_comments.py) Write a program that reads a string fname from the user, then opens the file fname.py (Python source) with that name. Copy each of its lines into a new file named 'strip_' + fname.py, deleting all Python comments as you go. Recall these begin with a # anywhere on a line and continue to the end of the line. Your output .py file should still be a valid program.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!