sorry, don't know should exact technical term problem statement title of thread might misleading/confusing. that's reason why not able search problem solution on google. okay, i'm developing simple social network users. want each user have own profile link. for example, if username of user 'xyz' profile link should ' http://example.com/user/xyz now how create "virtual" link? edit: okay, learned it's mod_rewrite , got similar question how dynamically rewrite url facebook routes php delicate matter. mod_rewrite can in beginning, after becoming mess , f*** rather help, when "big" software needs scalable. remembering "routes" not part of specific application, nomenclature "server" interprets request "client" , returns specific value "client" configuration of request. ie, "router" server. what recommend study http protocol, rest , on. this surely in many things, knowi...
is there method print terminal formatted output variable? print 'a\bb' --> 'b' i want string 'b' variable - how it? i working text string telnet. want work string printed screen. so looking this: simplify_string('a\bb') ==> 'b' another example carriage return: simplify_string('aaaaaaa\rbb') ==> 'bbaaaaa' this turns out quite tricky because there lot of terminal formatting commands (including e.g. cursor up/down/left/right commands, terminal colour codes, vertical , horizontal tabs, etc.). so, if want emulate terminal properly, terminal emulator! pyte ( pip install pyte ) implements vt102-compatible in-memory virtual terminal. so, can feed text, , formatted text it: import pyte screen = pyte.screen(80, 24) stream = pyte.bytestream() stream.attach(screen) stream.feed('xyzzz\by\rfoo') print ''.join(c.data c in screen[0]).rstrip() # prints foozy to handle multiple lines, joi...
Comments
Post a Comment