小编use*_*057的帖子

ValueError:字符串中的占位符无效

我试图通过使用python字符串模板为mutate_model.py脚本(http://salilab.org/modeller/wiki/Mutate%20model)制作我自己的模板,其中我替换了这五个变量Model,resType,resPos,pdb的值,链以重新编写并使用值写入新文件,但我收到如下错误:

MyAttempt:

import os
import re
import sys
import itertools
from modeller import *
from docopt import docopt
from string import Template
from modeller.automodel import *
from os.path import join, getsize    
from modeller.scripts import complete_pdb

Model="3o26"
resType="A"
resPos="275"
pdb="3o26.pdb"
chain="A"

dir=os.getcwd()
str = '''import sys
import os
from modeller import *
from modeller.optimizers import molecular_dynamics, conjugate_gradients
from modeller.automodel import autosched

def optimize(atmsel, sched):
    for step in sched:
        step.optimize(atmsel, max_iterations=200, min_atom_shift=0.001)
    refine(atmsel)
    cg = conjugate_gradients()
    cg.optimize(atmsel, max_iterations=200, min_atom_shift=0.001)

def …
Run Code Online (Sandbox Code Playgroud)

python string templates stringtemplate python-2.7

4
推荐指数
1
解决办法
2892
查看次数

标签 统计

python ×1

python-2.7 ×1

string ×1

stringtemplate ×1

templates ×1