This file contains 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 gmpy2 | |
def find_closest_prime(n): | |
up = gmpy2.next_prime(n) | |
return up | |
pass |
This file contains 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 requests | |
def send_text(numstring, message): | |
message = {"number":numstring, "message":message} | |
r = requests.post("http://textbelt.com/text", data=message) | |
return r.status_code, r.text |
This file contains 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 os, os.path | |
for root, _, files in os.walk("C:/some/dir"): | |
for f in files: | |
fullpath = os.path.join(root, f) | |
try: | |
if os.path.getsize(fullpath) < 10 * 1024: #set file size in kb | |
print fullpath | |
os.remove(fullpath) | |
except WindowsError: |
This file contains 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 os | |
paths = (os.path.join(root, filename) | |
for root, _, filenames in os.walk('C:\FolderName') | |
for filename in filenames) | |
for path in paths: | |
# the '#' in the example below will be replaced by the '-' in the filenames in the directory | |
newname = path.replace('#', '-') | |
if newname != path: |