но я все равно могу обратиться ко всем объектам
Иван
Степан
Иванович
Степанович
#!/usr/bin/env python
# -*- coding: utf-8 -*-
names_file = 'names.txt'
father_names_file = 'father_names.txt'
combinations_file = 'combinations.txt'
def main():
with open(combinations_file, 'w') as combinations:
with open(names_file, 'r') as names, open(father_names_file, 'r') as father_names:
names_lines = names.readlines()
father_names_lines = father_names.readlines()
for name in names_lines:
for father_name in father_names_lines:
line = "%s %s" % (name.replace("\n", ""),
father_name.replace("\n", ""))
combinations.write("%s\n" % line)
if __name__ == '__main__':
main()
Иван Иванович
Иван Степанович
Степан Иванович
Степан Степанович
#!/usr/bin/python
# -*- coding: utf-8
import sys
import requests
if len(sys.argv) > 1:
proxy_file = sys.argv[1]
url = "http://foto.konkurs.ru/like.php?id=123" # URL фэйковый )))
counter = 0
with open(proxy_file, 'r') as proxyFile:
for proxy_line in proxyFile.read().splitlines():
pr_dict = {"http": "http://%s" % proxy_line}
try:
result = requests.request(
"GET", url, timeout=(5, 10), proxies=pr_dict)
if result.status_code == requests.codes.ok:
counter += 1
print proxy_line
except requests.exceptions.ConnectTimeout:
print "Error: %s" % proxy_line
except requests.exceptions.ReadTimeout:
print "Error: %s" % proxy_line
except requests.exceptions.ConnectionError:
print "Error: %s" % proxy_line
except:
pass
print "Total success requests: %d" % counter
$ cat 1.txt 2.txt 3.txt | sort | uniq > proxies.txt
$ nohup ./votes.py ./proxies.txt &