Where to save trial status file on windows

The program shall have a 14 day trial period. Therefore, somewhere on the machine I want to save when the trial begun. It should be somewhere, where it doesn’t get deleted. What is the best place? (it should be locally on the machine, not a cloud solution) >Solution : You could put the install date… Read More Where to save trial status file on windows

File content is not available after fputcsv

Please explain to me why the function file_get_contents returns the contents of the file, while fread does not. How can I read file content after fputcsv? $file = fopen(‘test.txt’, ‘r+’); fputcsv($file, [1, 2, 4]); var_dump(fread($file, 1024)); var_dump(file_get_contents(‘test.txt’)); >Solution : fread() reads from the current position in the file stream, which is after what you just… Read More File content is not available after fputcsv

How to avoid repeating adding elements to a list?

I add the file path to the goups_of_file list. But because of the cycles, there are many identical elements in the list. How to add only 1 time despite loop? for file in files_names: for name_group, formats in groups_of_format.items(): if file.split(‘.’)[-1].upper() in groups_of_format.values(): groups_of_files[groups_of_format.keys()].append(file) >Solution : Use sets instead of lists. Elements in sets are… Read More How to avoid repeating adding elements to a list?

How to get a specific field from a text file using python

I have a text file named login.txt has the following data: {‘Username’:’hazem’, ‘Password’:’000′} {‘Username’:’john’, ‘Password’:’123′} And I have a function has two parameters Username and Password Once I pass the parameters as example john and 123 I want to check if the username and password is right or not from the text file. But I… Read More How to get a specific field from a text file using python