Python format() without {}
<p>I am working on python 3.6 64 bit.</p>

<p>Here is my code:</p>

<pre><code>days = "Mon Tue Wed Thu Fri Sat Sun"

print("Here are the days",format(days))
</code></pre>

<p>The output I got is </p>

<p>Here are the days Mon Tue Wed Thu Fri Sat Sun</p>

<p>I didn't add "{}" in my string. Also I used a comma "," instead of a dot "."</p>

<p>My understanding was that format() will replace {} in string with its arguments.</p>

<p>Question : How did format() worked without {} and . operator</p>

<p>I think you're thinking what's happening is similar to:</p>

<pre><code>print("Here are the days {}".format(days))
</code></pre>

<p>However, what's actually happening is that you're passing in multiple arguments to print(). If you look at the <a href="https://docs.python.org/3/library/functions.html#print" rel="nofollow">docs</a> for print(), it takes a couple of parameters:</p>

<pre><code>print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)
</code></pre>

<p>The asterisk in front of objects indicates it can take multiple arguments. Right now you're passing in "Here are the days" as the first argument, and format(days) as the second, which results in:</p>

<pre><code>Here are the days Mon Tue Wed Thu Fri Sat Sun
</code></pre>

python format