Skip to content

Instantly share code, notes, and snippets.

@halspg
Created February 27, 2015 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halspg/fed438340c59e77f87fa to your computer and use it in GitHub Desktop.
Save halspg/fed438340c59e77f87fa to your computer and use it in GitHub Desktop.
Pythonista用モジュール
def openapp(url):
import webbrowser
webbrowser.open(url)
def saveimage(img):
import photos
if isinstance(img, list):
map(photos.save_image, img)
else: photos.save_image(img)
def createnewfile(source, filename='New_Untitled.py'):
import console, os.path
if os.path.isfile(filename) is False :
with open(filename, 'w') as wf:
wf.write(source)
elif console.alert('File already exists.', 'Overwrite?', 'OK') == 1:
with open(filename, 'w') as wf:
wf.write(source)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment