On Sunday, 17 June 2018 07:25:57 UTC+5:30, Ben Bacarisse  wrote:
> Cameron Simpson <c...@cskk.id.au> writes:
> <snip>
> > ... In Python 3 we have "format strings", which let you write:
> >
> >  name = "Sharon"
> >  age = 35
> >  print(f"The person named {name|r} is {age} years old.")
> 
> You meant {name!r} I think there.
> 
> -- 
> Ben.

thanks, everyone.

I think I am now confused with format options in Python.
I tried an example as below and both print proper value:

age = 35

print "age is %s" % age
print "age is %d" % age

%run "D:/Projects/Initiatives/machine learning/programs/six.py"
age is 35
age is 35

I other languages I know the format specifier should be same as the variable 
type. For example, in the above case, it has to be %d and not %s
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to