subject

Write a function called strip_comments that takes as parameters a source file name (string, e. g. a python file), a destination file name (string), and a comment prefix (string) and that removes all comments that start with the prefix string from the first source file and writes the resulting content to the second file whose name is given. for python, the prefix is "#", for c/c++ it could be "//". if a comment starts at the beginning of a line then the entire line is removed from the resulting file. a comment in python and many other languages continues from the prefix string to the end f the line. example: suppose file test2.py has this content:

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 20:00
If you embed a word table into powerpoint, what happens when you make edits to the embedded data? a. edits made to embedded data change the data in the source file; however, edits made to the source file will not be reflected in the embedded data. b. edits made to embedded data don't change the data in the source file; however, edits made to the source file will be reflected in the embedded data. c. edits made to embedded data don't change the data in the source file, nor will edits made to the source file be reflected in the embedded data. d. edits made to embedded data will change the data in the source file, and edits made to the source file will be reflected in the embedded data.
Answers: 1
question
Computers and Technology, 23.06.2019 22:50
An environmental protection agency study of 12 automobiles revealed a correlation of 0.47 between engine size and emissions. at 0.01 significance level, can we conclude that there is a positive association between the variables? what is the p value? interpret.
Answers: 2
question
Computers and Technology, 24.06.2019 01:30
Hazel has just finished adding pictures to her holiday newsletter. she decides to crop an image. what is cropping an image?
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
Each time you save a document, you will need to type in the file type in which it should be saved you can select the save button to save it with the same file name if it has been previously saved you will need to select the location to save the file you will need to use the save as dialog box
Answers: 1
You know the right answer?
Write a function called strip_comments that takes as parameters a source file name (string, e. g. a...
Questions
question
Mathematics, 21.10.2020 19:01
question
Mathematics, 21.10.2020 19:01
question
Mathematics, 21.10.2020 19:01
Questions on the website: 13722367