当前位置: 动力学知识库 > 问答 > 编程问答 >

python 2.7 - .format - SyntaxError: can't assign to function call

问题描述:

I want to give a new name to a variable each time I am calling to a function. However, I am receiving an error - SyntaxError: can't assign to function call

def my_function(name):

name = name

'{}_file'.format(name) = open(yaml_file,'r')

my_function('buy')

my_function('sell')

分享给朋友:
您可能感兴趣的文章:
随机阅读: