Francesco Pietra <chiendar...@gmail.com> writes: > $ python renumber.py 134-176_rectified.pdb > Traceback (most recent call last): > File "renumber.py", line 6, in <module> > L = L[:24] + "%4d" % (int(L[24-28])+133) + L[28:] > ValueError: invalid literal for int() with base 10: ''
For this reason, it's best to break up big complex expressions like this into a sequence of simpler statements, so when one of them fails it's easier to see what went wrong. In this case, it's because you have L[24-28] where that's almost certainly not what you mean. It calculates 24-28, getting -4; then uses that value as an index into L. You probably wanted to say L[24:28], a slice instead of a single index. But, really, why are all these magic numbers littering the source, instead of using named values? You're writing code that will be a nightmare to maintain. -- \ “A lot of people are afraid of heights. Not me, I'm afraid of | `\ widths.” —Steven Wright | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list