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
print test |
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
#!/bin/sh | |
for FILE in *eps | |
do | |
IN=${FILE%.eps} | |
ps2pdf -dEPSCrop -dPDFSETTINGS=/prepress $IN.eps $IN.pdf | |
pdf2ps $IN.pdf $IN.eps | |
rm $IN.pdf | |
done |
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 urllib | |
import socket | |
def getLocalIP(): | |
return socket.gethostbyname(socket.gethostname()) | |
def getGrobalIP(): | |
sock = urllib.urlopen("http://ipcheck.ieserver.net/") | |
ip = sock.read() | |
sock.close() |
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
from decimal import * | |
getcontext().prec = 1000000#表示したい桁 デフォルトは28 | |
N = 100 | |
print (Decimal(1) + Decimal(1) / Decimal(N)) ** Decimal(N) | |
# or more precisely |
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 zlib | |
s = """ | |
The Zen of Python, by Tim Peters | |
Beautiful is better than ugly. | |
Explicit is better than implicit. | |
Simple is better than complex. | |
Complex is better than complicated. | |
Flat is better than nested. |
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
print("abcd", end=" ")#print "abcd" ,#2 | |
print("efgh")#print "efgh" | |
string = u'ぱいそん' | |
print(string)#エラー | |
string = 'ぱいそん' | |
print(string)# |
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
isinstance(None, type(None)) # True |
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 sys | |
import time | |
s = time.time() | |
N = int(sys.argv[1]) | |
prime = [1]*N | |
prime[0] = 0 | |
prime[1] = 0 |
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
class Var(): | |
x = "x" | |
_x = "_x" | |
__x = "__x" | |
def __init__(self): | |
self.y = "y" | |
self._y = "_y" | |
self.__y = "__y" |
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 inspect | |
print inspect.getargspec(function) | |
print inspect.getargspec(Class.method) |
OlderNewer