I have a dictionary in Julia named
Cols = {'Employee': 'varchar(255)',
'Sex': 'varchar(255)',
'Designation': 'varchar(255)',
'Code': 'varchar(255)',
'Salary': 'int'}
I want to join it in julia as -
'Employee varchar(255),Sex varchar(255),Designation varchar(255),Code varchar(255),Salary int'
In python I can do it by the following code-
cols = ",".join([f'{k} {v}' for k, v in cols.items()])
What's the alternative way in Julia.
CodePudding user response:
Here is a way to do it that is similar to your Python code:
Cols = Dict("Employee" => "varchar(255)",
"Sex" => "varchar(255)",
"Designation" => "varchar(255)",
"Code" => "varchar(255)",
"Salary" => "int")
join(("$k $v" for (k, v) in Cols), ",")