The second argument must be a string, so just put quotes around it:
cmd.label('CAs', '"%s%s" % (one_letter[resn],resi)')
This also works:
cmd.label('CAs', 'f"{oneletter}{resi}"')
Cheers,
Thomas
On Fri, Jul 8, 2022 at 6:09 PM sunyeping via PyMOL-users
wrote:
>
> Dear all,
>
> I want to label
Dear all,
I want to label residues with the resn+resi, and I tried the following command
one_letter ={'VAL':'V', 'ILE':'I', 'LEU':'L', 'GLU':'E', 'GLN':'Q', \
'ASP':'D', 'ASN':'N', 'HIS':'H', 'TRP':'W', 'PHE':'F', 'TYR':'Y',\
'ARG':'R', 'LYS':'K', 'SER':'S', 'THR':'T', 'MET':'M', 'ALA':'A',
Dear all,
I want to label residues with the resn+resi, and I tried the following command
one_letter ={'VAL':'V', 'ILE':'I', 'LEU':'L', 'GLU':'E', 'GLN':'Q', \
'ASP':'D', 'ASN':'N', 'HIS':'H', 'TRP':'W', 'PHE':'F', 'TYR':'Y',\
'ARG':'R', 'LYS':'K', 'SER':'S', 'THR':'T', 'MET':'M', 'ALA':'A',