There is a post on this topic already, but it does not have an explicit answer to the fundamental question which I am re-asking here:
How do you make 7zip commands from
The following one works for me, python 3.5.2, windows8.1, 7z path added to system
rc = subprocess.call(['7z', 'a', output_filename + '.zip', '-mx9', '-pSecret^)'] + [src_folder + '/'])
With two parameters, -mx9 means max compression, -pSecret^) means password is "Secret^)" , "^" is escape for ")"for windows system, but when you unzip, it will need type in the "^".
Without "^", windows system will not apply the password when 7z.exe creating the zip file.
Also, if you want to use "-mhe" switch, you need file format in 7z instead of zip.