I am reading sensor data and saving in file like this:
with open('serial_data.txt','a') as f:
Problem is, if I write the code five times, it appends in the same file. I want the data of each test in separate file for example if I run code four times, then it should save as: "serial_data_1.txt", "serial_data_2.txt", "serial_data_3.txt", "serial_data_4.txt"..... Is there any way to do this?