Answer to Question #223703 in Python for Ravan

Question #223703

Question 1:

write a program to find the given string in the root directory that contains a text file

1. In a recursive manner (case in sensitive )

2. only in the root directory

use command line arguments.

program_name -ri string root_dir (recursive)

program_name -si string root_dir (root director )

The output which file and line contains the string


1
Expert's answer
2021-08-09T02:35:04-0400
import os.path


save_path = input()


name_of_file = input()


completeName = os.path.join(save_path, name_of_file+".txt")         


file1 = open(completeName, "w")


toFile = input()


file1.write(toFile)


file1.close()

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS