Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

You will be passed a file path P and string S on the command line. Output the number of times the string S appears in the file P.

You will be passed a file path P and string S on the command line. Output the number of times the string S appears in the file P.

file = open(P, 'r')
ptext = file.read()
print(ptext.count(S))
file.close()
 
PREVIOUS NEXT
Tagged: #You #passed #file #path #P #string #S #command #Output #number #times #string #S #appears #file
ADD COMMENT
Topic
Name
2+9 =