Как я могу разрешить пользователю самим именем «copied_holter.ecg»? Я дал это имя, но хочу, чтобы пользователь выбирал все, что захочет.Разрешить пользователю указывать новый файл
class MyParser(argparse.ArgumentParser):
def error(self, message):
sys.stderr.write('error: %s\n' % message)
self.print_help()
sys.exit(2)
parser = MyParser(util_help)
parser.add_argument('filename', help='The full path/to/holter_file that you would like to parse.', action="store")
parser.add_argument('packet_start', help='The offset location of the start packet ID in base 10 decimal', action="store", type = int)
parser.add_argument('packet_end', help='The offset location of the end packet ID in base 10 decimal', action = "store", type = int)
parser.add_argument('new_filename', help='The name of the new file with the copied holter data chosen by user.', action = "store")
args = parser.parse_args()
start = args.packet_start
end = args.packet_end
if start % 5 != 0:
start = int(5*round(float(start)/5))
if end % 5 != 0:
end = int(5*round(float(end)/5))
try:
print("Beginning copying of holter data...")
# Output the specific holter data
output_file = open(new_filename+".ecg", 'w')
Этот код ничего нам не говорит .... – Seekheart