Python: python analog of php var in string

Trabla: Python: python analog of php var in inline string

Solving:

Use format(format_string, *args, **kwargs)
https://docs.python.org/2/library/string.html

php:

$name = 'Trololo';
$hello = "Hello $name !!!";
echo $hello;

python:

name = 'Trololo'
hello = 'Hello {0} !!!'.format( name )
print hello


No comments:

Post a Comment