Incomplete Format

Anyone who is getting ValueError: incomplete format exceptions when doing a string format in python should understand that the part inside the () is just an array lookup. You still need a format type after it.

I have %(count) %(adj) %(noun)

doesn’t work since you didn’t say they were integers and strings. You need to do

I have %(count)i %(adj)s %(noun)s

which is the same as

I have %i %s %s

with position indexed values.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: