将字符串列表转换为现有变量

时间:2017-10-20 09:26:44

标签: python string python-2.7 python-3.x variables

我想知道如何将字符串列表转换为现有变量

示例:

from collections import defaultdict
d = defaultdict(lambda: defaultdict(dict))


def user_data(user_id, gst, total, uname, adress, service, quantity):
    uyt = ['gst', 'total', 'uname', 'adress' 'service', 'quantity'] 
    for r in uyt:
        d[user_id][r]= r // where i want to pass it 

    if __name__ == '__main__':
    user_data(1234, '8', "2345", 'mock', 'mumbai', 'fedx', '4' )

0 个答案:

没有答案