Answers for "linux 2 users creating the same file and the same time"

PHP
3

php increase number in file by one

<?php
$file = 'count.txt';
$fdata = file_get_contents ( $file );
$fdata = intval($fdata) + 1;
file_put_contents($file, $fdata);
?>
Posted by: Guest on May-12-2020
0

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()
Posted by: Guest on February-12-2020

Code answers related to "linux 2 users creating the same file and the same time"

Browse Popular Code Answers by Language