I see two answers with good qualities, each with a small flaw, so I will give my take on it:
Try os.path.exists, and consider os.makedirs for the creation.
if not os.path.exists(directory):
os.makedirs(directory)
As noted in comments and elsewhere, there's a race condition - if the directory...
We are writing Python code using Vim, and every time we want to run my code, we type this inside Vim
Try the xlrd library.
From what I can see from your comment, something like the snippet below might do the trick. I'm assuming here that you're just searching one column for the word 'john', but you could add more or make this into a more generic function.
from xlrd import open_workbook
book...
Now that you have your SMTP connection set up and authorized your app with Google, you can finally use Python to send email with Gmail
When to use reshape and when resize?.
Both reshape and resize change the shape of the numpy array; the difference is that using resize will affect the original array while using reshape create a new reshaped instance of the array.
This is clarified through an example:
Reshape
import numpy as np
r = np.arange(16)
print('original...