Personally I would break the problem into to separate parts, the Python part (if that is your weapon of choice) doing file processing etc and the PBS job launch script part. I would definitely use bash scripting for the PBS part because it sounds like you want to make (easy) use of PBS variables and leverage what PBS gives you to launch in a variety of ways. Your PBS script then calls your Python code from within the bash script with these options.
Things I have used are job arrays, which allow the PBS variable to give each job a different value in a $PBS_ARRAYID environment variable.
I have also used the -v option to pass my own user defined variable names. This has the advantage that you define your variables at launch time.
You can also use the job name itself to launch your code with a particular parameter. This has an advantage in that the result log file will also has the job name.
The quickest way to see what you are working with is to launch a job with "env" and you can see what you get to work with in the output. It is worth doing this as I have found what you get depends on the batch system and how the job is launched. Also be warned that what the documentation (man qsub) says an option "should" do and what it "actually" does are often different (so trial and error is called for).
Here's an example of how I launch OpenFOAM to adapt to the number of cores/nodes provided. It creates a config file that OpenFOAM interprets for splitting up the calculation. I used the jobname to configure the speed of the simulation.
#PBS -N vespa_LES
#PBS -l walltime=48:00:00
#PBS -l nodes=2:ppn=10,pmem=4000MB
#PBS -m abe
echo Here are the Vespa variables used
echo Running with $PBS_NP processors across $PBS_NUM_NODES nodes. $PBS_NUM_PPN procs per node
echo "vespa_env_procs $PBS_NP;" >> ./vespa_env
echo "vespa_env_num_nodes $PBS_NUM_NODES;" >> ./vespa_env
echo "vespa_env_num_ppn $PBS_NUM_PPN;" >> ./vespa_env
echo "vespa_env_jobname $PBS_JOBNAME;" >> ./vespa_env
module load openfoam/2.2.2
The short version of the above is that PBS provides some helper variables and I would use those to simplify launching a variety of jobs with the same code.