开发者

How can I easily represent a raw block of text as a string?

I created a very simple console program that mimics GLaDOS's song from the end of the game, Portal, with the audio and the words all working fine. I ran into a problem when trying to draw the logo at the end.

Is there a way to set a block of text as it is shown into a str开发者_如何学Pythoning so I may write it to the console? I know that '\n' is a newline but I want to be able to write this out easier.

This is what I have at the moment:

Console.Clear();
TypeText("thank you for participating in the Aperture Science Experiments/nPress any button for delicious cake/n
             .,-:;//;:=,
          . :H@@@MM@M#H/.,+%;,
       ,/X+ +M@@M@MM%=,-%HMMM@X/,
     -+@MM; $M@@MH+-,;XMMMM@MMMM@+-
    ;@M@@M- XM@X;. -+XXXXXHHH@M@M#@/.
  ,%MM@@MH ,@%=             .---=-=:=,.
  =@#@@@MX.,                -%HX$$%%%:;
 =-./@M@M$                   .;@MMMM@MM:
 X@/ -$MM/                    . +MM@@@M$
,@M@H: :@:                    . =X#@@@@-
,@@@MMX, .                    /H- ;@M@M=
.H@@@@M@+,                    %MM+..%#$.
 /MMMM@MMH/.                  XM@MH; =;
  /%+%$XHH@$=              , .H@@@@MX,
   .=--------.           -%H.,@@@@@MX,
   .%MM@@@HHHXX$$$%+- .:$MMX =M@@MM%.
     =XMMM@MM@MM#H;,-+HMM@M+ /MMMX=
       =%@M@M#@$-.=$@MM@@@M; %M%=
         ,:+$+-,/H#MMMMMMM@= =,
               =++%%%%+/:-.", 90);


Use a verbatim literal string by prefixing with an "@".


You could load a textfile instead and output the contents as text.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜