You can use a list comprehension to iterate over all of the column names in your DataFrame df and then only select those that begin with 'd'.
df = pd.DataFrame({'a': {0: 10}, 'b': {0: 14}, 'c': {0: 12},
'd1': {0: 44}, 'd2': {0: 45}, 'd3': {0: 78}})
Use list comprehension to iterate over the columns in the dataframe and return their names (c below is a local variable representing the column name).
>>> [c for c in df]
['a', 'b', 'c', 'd1', 'd2', 'd3']
Then only select those beginning with 'd'.
>>> [c for c in df if c[0] == 'd'] # As an alternative to c[0], use c.startswith(...)
['d1', 'd2', 'd3']
Finally, pass this list of columns to the DataFrame.
df[[c for c in df if c.startswith('d')]]
>>> df
d1 d2 d3
0 44 45 78
===========================================================================
TIMINGS (added Feb 2018 per comments from devinbost claiming that this method is slow...)
First, lets create a dataframe with 30k columns:
n = 10000
cols = ['{0}_{1}'.format(letters, number)
for number in range(n) for letters in ('d', 't', 'didi')]
df = pd.DataFrame(np.random.randn(3, n * 3), columns=cols)
>>> df.shape
(3, 30000)
>>> %timeit df[[c for c in df if c[0] == 'd']] # Simple list comprehension.
# 10 loops, best of 3: 16.4 ms per loop
>>> %timeit df[[c for c in df if c.startswith('d')]] # More 'pythonic'?
# 10 loops, best of 3: 29.2 ms per loop
>>> %timeit df.select(lambda col: col.startswith('d'), axis=1) # Solution of gbrener.
# 10 loops, best of 3: 21.4 ms per loop
>>> %timeit df.filter(regex=("d.*")) # Accepted solution.
# 10 loops, best of 3: 40 ms per loop