On Wed, Mar 30, 2011 at 8:19 PM, Martin De Kauwe <mdeka...@gmail.com> wrote: > what is the character limit on a one liner :P. Very interesting > jesting apart, any more?
Not sure if this can be redone as a one-liner; currently it's two. for i in range(3): print '\n\t"'+("minor","medium","major")[i]+' ":({\n\t\t'+"\n\t\t".join([q[0]+',"'+" ".join(q[1:])+'",' for q in [q.split("\x96")[-1].split(" ") for q in "\n".join([q.split(" ",3)[i]+" "+q.split(" ",3)[3] for q in a.split("\n")]).replace("\x92","'").split("\n")] if q[0]!="\x97"])+'\n\t}),' That's the code I used in IDLE to translate this: Minor Medium Major Ring Market Price 01–18 — — Protection +1 2,000 gp 19–28 — — Feather falling 2,200 gp 61–70 01–05 — Counterspells 4,000 gp 71–75 06–08 — Mind shielding 8,000 gp 86–90 24–28 — Ram 8,600 gp — 29–34 — Climbing, improved 10,000 gp — 35–40 — Jumping, improved 10,000 gp — 41–46 — Swimming, improved 10,000 gp 91–93 47–51 — Animal friendship 10,800 gp 94–96 50–56 01–02 Energy resistance, minor 12,000 gp 99–100 62–66 — Water walking 15,000 gp — 94–97 29–32 Blinking 27,000 gp — 98–100 33–39 Energy resistance, major 28,000 gp — — 40–49 Protection +4 32,000 gp — — 98 Elemental command (fire) 200,000 gp — — 99 Elemental command (water) 200,000 gp — — 100 Spell storing, major 200,000 gp into something that my dice-roller can use. (In the interests of brevity I've chopped a whole lot of the table out, but each column contains every possible value from 01 to 100.) Not as "cool" as the previous one, but it sure was handy! In case you're wondering: Yes, that is Dungeons and Dragons. I run an online D&D server. Nerd? Only slightly..... Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list