1. https://developers.google.com/gmail/api/quickstart/python
Run gmail/quickstart/quickstart.py
gmail/quickstart/quickstart.py
from __future__ import print_function from googleapiclient.discovery import build from httplib2 import Http from oauth2client import file, client, tools # If modifying these scopes, delete the file token.json. SCOPES = 'https://www.googleapis.com/auth/gmail.readonly' def main(): """Shows basic usage of the Gmail API. Lists the user's Gmail labels. """ # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. store = file.Storage('token.json') creds = store.get() if not creds or creds.invalid: flow = client.flow_from_clientsecrets('credentials.json', SCOPES) creds = tools.run_flow(flow, store) service = build('gmail', 'v1', http=creds.authorize(Http())) # Call the Gmail API results = service.users().labels().list(userId='me').execute() labels = results.get('labels', []) if not labels: print('No labels found.') else: print('Labels:') for label in labels: print(label['name']) if __name__ == '__main__': main()
2. https://myaccount.google.com/lesssecureapps?pli=1 3. https://console.developers.google.com/iam-admin/iam?project=YOUR_PROJECT&pli=1 4. https://console.developers.google.com/apis/credentials/consent?project=YOUR_PROJECT
0 Comments
In order to split a given list of integers into n equal slices we simply code it as a list generator:
Python shell:
>>list(split(range(11), 3))
[[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10]]
Suppose you have a randomA.csv file containing:
and another randomB.csv file containing:
In order to extract the values from randomA.csv that are unique to randomB.csv:
awk 'FNR==NR{a[$0]++;next}(!($0 in a))' randomA.csv randomB.csv
learn more about AWK : http://www.askapache.com/linux/awk-tutorial.html
First you strip the heterogeneous extensions off (.jpg in my example) :
for i in *.*; do mv $i ${i%.*}; done ls img1 img2 img3 Then, you add your desired suffix to the extension-stripped files : for i in *; do mv $i $i.jpg; done ls img1.jpg img2.jpg img3.jpg |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |