strings Flashcards
1
Q
str(x)
A
convert input to string
2
Q
title()
A
returns a copy of the string in which first characters of all the words are capitalized
3
Q
print(‘Hello, %s’ % name)
A
positional formatting
4
Q
print(‘Hello, {}’.format(name))
A
string literals
5
Q
print(f’Hello, {name}!’)
A
formatted strings
6
Q
from string import Template
t = Template(‘Hey, $name!’)
print(t.substitute(name=name))
A
Template strings