1

I am trying to get the curly braces around capablities printed but it doesnt work for some reasons. Please advise.

name = 'john'
age = '18'
country = 'us'

grant = f"""
path "{name}-{age}-{country}" {
     capabilities = [ "update", "read", "list" ] 
  }
"""
print(grant.format(name,app_name,env))




Karthik
  • 27
  • 3

1 Answers1

1

If you're using f-strings you don't need to use .format:

name = 'john'
age = '18'
country = 'us'

grant = f"""
path "{name}-{age}-{country}" {{
    capabilities = [ "update", "read", "list" ]
}}
"""
print(grant)

prints out

path "john-18-us" {
     capabilities = [ "update", "read", "list" ]
}
JMeahl
  • 86
  • 3