Hacker News new | ask | show | jobs
by the_gigi 1627 days ago
I often use split().

Instead of:

  s = ['a', 'b', 'c']
I'll type:

  s = 'a b c'.split()
For multiline lists where I want to get rid of leading whitespace I'll add lstrip():

  lines = """line 1
             line 2
             line 3
  """.split('\n')
  lines = [line.lstrip() for line in lines]