advertools.ad_create module — advertools 0.1a1 documentation

# advertools.ad_create module

`advertools.ad_create.` `ad_create`(template, replacements, fallback, max_len=30)

  Insert each of the replacement strings in its place within template

  template : a string format template, using braces repls : replacements string to be inserted in template fallback : the string to insert in template in case the replacement is too long max_len : the maximum allowed length of the full string

  formatted : list of strings

      >>> ad_create('Let's count {}', ['one', 'two', 'three'], 'one', 20)
      ["Let's count one", "Let's count two", "Let's count three"]

      >>> ad_create('My favorite car is {}', ['Toyota', 'BMW', 'Mercedes', 'Lamborghini'], 'great', 28)
      ['My favorite car is Toyota', 'My favorite car is BMW', 'My favorite car is Mercedes',
      'My favorite car is great']