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 datetime import datetime | |
now = datetime.now() | |
print now | |
current_month = now.month | |
current_day = now.day | |
current_year = now.year | |
current_hour = now.hour | |
current_minute = now.minute | |
current_second = now.second | |
print current_month |
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
pyg = 'ay' | |
original = raw_input('Enter a word to be translated:') | |
word = original.lower() | |
first = word[0] | |
new_word = word + pyg | |
if len(original) > 0 and original.isalpha(): | |
if first == 'a' or first == 'e' or first == 'i' or first == 'u': | |
print new_word | |
else: | |
new_word = word[1:] + word[0] + pyg |
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 ftplib import FTP | |
ftp = FTP('ftp.cwi.nl') # connect to host, default port | |
ftp.login() # user anonymous, passwd anonymous@ | |
ftp.retrlines('LIST') # list directory contents | |
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 ftplib | |
ftp = ftplib.FTP('ftp.sunet.se', 'anonymous', 'anonymous@sunet.se') | |
print "File List: " | |
files = ftp.dir() | |
print files | |
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 re | |
print "we will try to open this url, in order to get IP Address" | |
url = "http://checkip.dyndns.org" | |
print url | |
request = urllib.urlopen(url).read() |
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
#importing the time module | |
import time | |
#welcoming the user | |
name = raw_input("What is your name? ") | |
print "Hello, " + name, "Time to play hangman!" | |
print "\n" | |
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
# Captain Deadbones, activestate.com | |
from Tkinter import * | |
from tkSimpleDialog import askstring | |
from tkFileDialog import asksaveasfilename | |
from tkMessageBox import askokcancel | |
class Quitter(Frame): | |
def __init__(self, parent=None): | |
Frame.__init__(self, parent) |
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
# copied from jay on activestate.com | |
#droids.py | |
import time | |
import random | |
from random import randint | |
print('\n' * 100) | |
print('\n\n[-Droids : by jay : type help-]') | |
print('\n\n\n------------------------') | |
print(' DROIDS') |
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
############################################################ | |
# Cloned from jay on activestate.com | |
# - My version on the game "Dragon Realm". | |
# - taken from the book "invent with python" by Al Sweigart. | |
# - thanks for a great book Mr Sweigart. | |
# - this code takes advantage of python 3. | |
############################################################ | |
#files.py | |
import random |
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
## bctg.py | |
## by andrew wayne teesdale jr. | |
class LL: | |
def __init__(self, ll, name): | |
import random | |
self.randnum=random.choice(['True', 'False']) | |
self.msg=random.choice(['I dont know.', 'Oh, Yes '+ll, 'I think '+name+' knows.']) | |
def say_to(self, msg): | |
## msging system | |
print msg |
OlderNewer