Golehe.net Go乐呵| PHP && Python… | Since 2009.11.25 嘛钱不钱的,乐呵乐呵得了

Archive for the ‘Python’ Category

Rot-13 暗码

12.02.2009 · Posted in OTHER, Python

rot-13 是一种简单的暗码 经常用于文字游戏 意思就是一个字母的后面第十三个字母 rot-13是它本身的逆反  WIKI百科上这样说。。 一个好玩的东西。。用于骂人===== #! /usr/bin/python3 # -*- coding : utf-8 -*- def rot_13(string,offset=13): def encode_char(ch): asc = ord(ch) if(asc > 96) and (asc < 123): return chr((asc-97+offset).__mod__(26) + 97) elif(asc > 64) and (asc < 91): return chr((asc-65+offset).__mod__(26) + 65) else: return ch temp = '' for char in string: temp ...

Python challenge

12.01.2009 · Posted in Python

Python challenge 目前有三十三关 中午抽空做了三关 。。。 挺有意思的。。 http://www.pythonchallenge.com/pc/def/0.html 0.html是第一关 过去了才能到第二关 把0.html 改成xxxx.html就可以到达第二关 xxxx是第一关的答案 按照提示做。。 ...

关于我的python

11.27.2009 · Posted in ON MY WAY, OTHER, Python

开始是做PHP的。 现在在学python.. 不知不觉的自己也就按照原先的思维来写东西。。。 很无奈。。 不知道该从哪下手 .继续吧。。。 很明显的带着php的风格 #! /usr/bin/python3 # -*- coding: utf-8 -*- # Filename: mysqlite.py import sqlite3 class MySqlite: con = '' cur = '' level = None DBpath = 'test.db' operation = ('none','fetchall','fetchone','rowcount') def __init__(self,DBpath="",level=None): if DBpath: self.DBpath = DBpath self.con = sqlite3.connect(self.DBpath) self.con.isolation_level = level self.level = level self.cur = self.con.cursor() ...