Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python为带有单引号的函数提供参数_Python - Fatal编程技术网

python为带有单引号的函数提供参数

python为带有单引号的函数提供参数,python,Python,我有一个函数为其他函数提供它的参数 def errata_eus_repo(rhel_ver, cv_name): rhel_check = "Red Hat Enterprise Linux Extended Update Support" + " " + rhel_ver cv_name_errat = [] for eus_repo in erra_eus_repo: errata = eus_repo[0] product = eu

我有一个函数为其他函数提供它的参数

def errata_eus_repo(rhel_ver, cv_name):
    rhel_check = "Red Hat Enterprise Linux Extended Update Support" + " " + rhel_ver
    cv_name_errat = []
    for eus_repo in erra_eus_repo:
        errata = eus_repo[0]
        product = eus_repo[1]
        if product == rhel_check:
            cv_name_errat.extend([cv_name, errata])
            return cv_name_errat

def filter_ver(rhel_ver):
    regex = re.compile('\d{1}\.\d{1}')
    if not regex.match(rhel_ver):
        return False
    return True

for cv_rhel_ver in name_rhel:
    if not filter_ver(cv_rhel_ver):
        cv_name = str(cv_rhel_ver)
    if filter_ver(str(cv_rhel_ver)):
        rhel_ver = str(cv_rhel_ver)

    errata_eus_lst = errata_eus_repo(str(rhel_ver), str(cv_name))
    print(errata_eus_lst)
当我调用勘误表时,我没有得到结果

 errata_eus_lst = errata_eus_repo(str(rhel_ver), str(cv_name))
但是,如果我将变量直接发送到函数,我会得到正确的结果


我认为问题可能是为参数
errata\u eus\u repo(str(“rhel\u ver”)、str(“cv\u name”)
提供了双引号,但我仍然没有得到任何结果。有什么想法吗

引号仅用于传递文本变量名,而不是该变量包含的数据。您的问题在于如何在迭代周期中使用变量


在循环中的每次迭代中,您只初始化一个变量,
rhel\u ver
cv\u name
。for循环应该给您一个错误。

name\u rhel的原始值是多少?您的缩进是扭曲的。