youYou can doachieve this something like this :
headersx = { 'cookie': '__cfduid={}; PHPSESSID={}; lang=de; CF-RAY={}'.format(cfuid, phpid, cfray) } Alternatively, using String Formatting, you can do something like this :
headersx = { 'cookie': '__cfduid=%s; PHPSESSID=%s; lang=de; CF-RAY=%s' % (cfuid, phpid, cfray) } For cfuid = 'a', phpid = 'b' and cfray = 'c', the headersx dictionary will result in :
{'cookie': '__cfduid=a; PHPSESSID=b; lang=de; CF-RAY=c'} Note that dictionary needs to have key value pairs separated by colon(:) .