Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

bbcode generator halp

Name: Anonymous 2011-03-09 21:55

I am trying to write a simple bbcode Python script.  How can I improve this?  Also, how can I get rid of the ":arg" when the result is actually printed.  YES I KNOW ITS PROBABLY FUCKING UGLY AND I AM A SHITTY PROGRAMMER FORCED INDENTATION OF ANUS READ SICP ETC

import string

b = '[b]'
b2 = '[/b]'

u = '[u]'
u2 = '[/u]'

o = '[o]'
o2 = '[/o]'

i = '[i]'
i2 = '[/i]'

s = '[s]'
s2 = '[/s]'

m = '[m]'
m2 = '[/m]'

c = '[code]'
c2 = '
'

sp = ''
sp2 = '
'


bbcode = raw_input('ENTER ANUS, RECEIVE HAX: ')

if ':b' in bbcode:
    print b + bbcode + b2
   
if ':u' in bbcode:
    print u + bbcode + u
   
if ':o' in bbcode:
    print o + bbcode + o2

if ':i' in bbcode:
    print i + bbcode + i2
   

if ':s' in bbcode:
    print s + bbcode + s2

if ':m' in bbcode:
    print m + bbcode + m2
   
if ':c' in bbcode:
    print c + bbcode + c2

if ':sp' in bbcode:
    print sp + bbcode + sp2[/code]

Name: Anonymous 2011-03-09 22:05

It's fucking ugly and you're a shitty programmer.

Name: Anonymous 2011-03-09 22:20

Mine has no such code repetition, it's all handled by clean macros and functions.

Name: Anonymous 2011-03-10 4:18

I have?

:(

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List