A common design pattern: truncate a string to X chars if the string is long, and show a ‘…’ to indicate the string has been truncated.
What’s the shortest way to write this code?
http://stackoverflow.com/questions/2872512/python-truncate-a-long-string
x[:10] + (x[10:] and '...')
Your second colon is in the wrong place; the code needs to be:
x[:10] + (x[10:] and ‘…’)
x[10:] returns the text from index 10 on if it exists, else an empty string. It is that empty string that determines whether the “and” condition is satisfied.
Indeed good eye!
リップサービス 水着