This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| d = {} | |
| for email, site in zip(our_data, ALL_LINKS_ARTICLE): | |
| d.setdefault(email, []).append(site) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >>> a = list(map(int, input().split())) | |
| >? 4 -1 4 1 1 | |
| >>> a | |
| [4, -1, 4, 1, 1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import argparse | |
| PARSER = argparse.ArgumentParser('enter the directory where you want to save the data') | |
| PARSER.add_argument("-d", "--directory", type=str, | |
| help="where to save data? Example: /home/cat/example_folder/") | |
| ARGS = PARSER.parse_args() | |
| OUR_DIR = ARGS.directory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >>> from datetime import datetime, timedelta | |
| >>> a = datetime(2010, 12, 12) | |
| >>> b = datetime(2009, 12, 12) | |
| >>> a-b | |
| datetime.timedelta(365) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| virtualenv -p /usr/bin/python2.7 project2_7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ source ./<environmentname>s/bin/activate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| f.write("Ranking, Code, Stock," | |
| "Links, Closing Price, Delta," | |
| "Net Purchase Amt, Buy Amt, Sell Amt, Turnover") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "//a[starts-with(descendant::text(), 'Next page')]/@href" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from scrapy import Request | |
| req = Request("url.com", headers={"USER-AGENT" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 OPR/45.0.2552.888"}) | |
| fetch(req) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| import requests | |
| import pandas as pd | |
| url = "url_with_table" | |
| df = pd.read_html(url) | |
| df = df[0] | |
| df.columns = df.iloc[0] |