How to use triple quotes?2019 Community Moderator ElectionHow to merge two dictionaries in a single expression?How do I check whether a file exists without exceptions?How do JavaScript closures work?How do I iterate over the words of a string?When to use double or single quotes in JavaScript?How do I read / convert an InputStream into a String in Java?How do I make the first letter of a string uppercase in JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I convert a String to an int in Java?

Every subset equal to original set?

Wardrobe above a wall with fuse boxes

How can I highlight parts in a screenshot

Difference between 'stomach' and 'uterus'

Must 40/100G uplink ports on a 10G switch be connected to another switch?

Four buttons on a table

Can we carry rice to Japan?

Book about a time-travel war fought by computers

Where is the fallacy here?

What does each site of a vanilla 9.1 installation do?

Reason why dimensional travelling would be restricted

If there are any 3nion, 5nion, 7nion, 9nion, 10nion, etc.

Plagiarism of code by other PhD student

Why are special aircraft used for the carriers in the United States Navy?

Rationale to prefer local variables over instance variables?

Are small insurances worth it

Deal the cards to the players

What is the meaning of "notice to quit at once" and "Lotty points”

In which way proportional valves are controlled solely by current?

Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?

Meaning of word ягоза

Sometimes a banana is just a banana

Is there a limit on the maximum number of future jobs queued in an org?

Formatting a table to look nice



How to use triple quotes?



2019 Community Moderator ElectionHow to merge two dictionaries in a single expression?How do I check whether a file exists without exceptions?How do JavaScript closures work?How do I iterate over the words of a string?When to use double or single quotes in JavaScript?How do I read / convert an InputStream into a String in Java?How do I make the first letter of a string uppercase in JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I convert a String to an int in Java?










0















for some reason even when using triple quotes the text is printed wrongly
These are the variable that I have the problem with... I have other variables with triple quotes that when being printed is printed correctly! the problem is only with these ASCII ones



One of the problematic variables is this ASCII the other ones are the same just with fewer body parts ;)



 gv_sixTries = '''
___________.._______
| .__________))______|
| | / / ||
| |/ / ||
| | / ||.-''.
| |/ |/ _
| | || `/,|
| | (\`_.'
| | .-`--'.
| | /Y . . Y
| | // | | \
| | // | . | \
| | ') | | (`
| | ||'||
| | || ||
| | || ||
| | || ||
| | / | |
| | `-' `-'
| |
| |
: :
. .
'''


the variable is being printed like that:
image



the print code is just a normal print(gv_NUMBERTries)



OS: Windows 10



interpreter: Python IDLE 3.7.2










share|improve this question






















  • Seems like you are missing newline characters on those distorted lines

    – systrigger
    13 hours ago















0















for some reason even when using triple quotes the text is printed wrongly
These are the variable that I have the problem with... I have other variables with triple quotes that when being printed is printed correctly! the problem is only with these ASCII ones



One of the problematic variables is this ASCII the other ones are the same just with fewer body parts ;)



 gv_sixTries = '''
___________.._______
| .__________))______|
| | / / ||
| |/ / ||
| | / ||.-''.
| |/ |/ _
| | || `/,|
| | (\`_.'
| | .-`--'.
| | /Y . . Y
| | // | | \
| | // | . | \
| | ') | | (`
| | ||'||
| | || ||
| | || ||
| | || ||
| | / | |
| | `-' `-'
| |
| |
: :
. .
'''


the variable is being printed like that:
image



the print code is just a normal print(gv_NUMBERTries)



OS: Windows 10



interpreter: Python IDLE 3.7.2










share|improve this question






















  • Seems like you are missing newline characters on those distorted lines

    – systrigger
    13 hours ago













0












0








0


1






for some reason even when using triple quotes the text is printed wrongly
These are the variable that I have the problem with... I have other variables with triple quotes that when being printed is printed correctly! the problem is only with these ASCII ones



One of the problematic variables is this ASCII the other ones are the same just with fewer body parts ;)



 gv_sixTries = '''
___________.._______
| .__________))______|
| | / / ||
| |/ / ||
| | / ||.-''.
| |/ |/ _
| | || `/,|
| | (\`_.'
| | .-`--'.
| | /Y . . Y
| | // | | \
| | // | . | \
| | ') | | (`
| | ||'||
| | || ||
| | || ||
| | || ||
| | / | |
| | `-' `-'
| |
| |
: :
. .
'''


the variable is being printed like that:
image



the print code is just a normal print(gv_NUMBERTries)



OS: Windows 10



interpreter: Python IDLE 3.7.2










share|improve this question














for some reason even when using triple quotes the text is printed wrongly
These are the variable that I have the problem with... I have other variables with triple quotes that when being printed is printed correctly! the problem is only with these ASCII ones



One of the problematic variables is this ASCII the other ones are the same just with fewer body parts ;)



 gv_sixTries = '''
___________.._______
| .__________))______|
| | / / ||
| |/ / ||
| | / ||.-''.
| |/ |/ _
| | || `/,|
| | (\`_.'
| | .-`--'.
| | /Y . . Y
| | // | | \
| | // | . | \
| | ') | | (`
| | ||'||
| | || ||
| | || ||
| | || ||
| | / | |
| | `-' `-'
| |
| |
: :
. .
'''


the variable is being printed like that:
image



the print code is just a normal print(gv_NUMBERTries)



OS: Windows 10



interpreter: Python IDLE 3.7.2







python string variables quote






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 13 hours ago









Amit KerenAmit Keren

104




104












  • Seems like you are missing newline characters on those distorted lines

    – systrigger
    13 hours ago

















  • Seems like you are missing newline characters on those distorted lines

    – systrigger
    13 hours ago
















Seems like you are missing newline characters on those distorted lines

– systrigger
13 hours ago





Seems like you are missing newline characters on those distorted lines

– systrigger
13 hours ago












4 Answers
4






active

oldest

votes


















2














Add an r to your string



gv_sixTries = r'''
___________.._______
| .__________))______|
| | / / ||
| |/ / ||
| | / ||.-''.
| |/ |/ _
| | || `/,|
| | (\`_.'
| | .-`--'.
| | /Y . . Y
| | // | | \
| | // | . | \
| | ') | | (`
| | ||'||
| | || ||
| | || ||
| | || ||
| | / | |
| | `-' `-'
| |
| |
: :
. .
'''


This tells python to use the string a raw literal, not using backslashes as escape characters






share|improve this answer


















  • 1





    a bit faster than me, well done ;)

    – Tryph
    12 hours ago


















0














The problem comes from unwanted escaping of new line characters due to antislashes at the end of some lines.



Simply declare a raw string by prefixing your string by r, and it will fix the problem.



gv_sixTries = r'''
___________.._______
| .__________))______|
| | / / ||
| |/ / ||
| | / ||.-''.
| |/ |/ _
| | || `/,|
| | (\`_.'
| | .-`--'.
| | /Y . . Y
| | // | | \
| | // | . | \
| | ') | | (`
| | ||'||
| | || ||
| | || ||
| | || ||
| | / | |
| | `-' `-'
| |
| |
: :
. .
'''





share|improve this answer






























    0














    The error comes due to a backslash character in the string which is used for printing escape sequence characters(n, t, , etc.). Use raw string for printing a backslash character on the screen, something like:



    gv_Tries = r"""
    ___________.._______
    | .__________))______|
    | | / / ||
    | |/ / ||
    | | / ||.-''.
    | |/ |/ _
    | | || `/,|
    | | (\`_.'
    | | .-`--'.
    | | /Y . . Y
    | | // | | \
    | | // | . | \
    | | ') | | (`
    | | ||'||
    | | || ||
    | | || ||
    | | || ||
    | | / | |
    | | `-' `-'
    | |
    | |
    : :
    . .
    """





    share|improve this answer






























      0














      The problem is because some of your lines end with the Python escape character: .




      The backslash () character is used to escape characters that otherwise have a special meaning, such as newline, backslash itself, or the quote character.



      String and Bytes literals




      When a line ends with a backslash, it tells Python that the line is continued on the next line.



      if some_condition 
      or some_other_condition:


      To counter this, you either want to 'double up' your backslashes to escape your escape characters:



      gv_sixTries = '''
      | | /Y . . Y\
      | | // | | \\
      | | // | . | \\
      '''


      Or mark your string with an r to mark it as a raw string.




      Both string and bytes literals may optionally be prefixed with a letter 'r' or 'R'; such strings are called raw strings and treat backslashes as literal characters.



      String and Bytes literals




      gv_sixTries = r'''
      | | /Y . . Y
      | | // | | \
      | | // | . | \
      '''





      share|improve this answer






















        Your Answer






        StackExchange.ifUsing("editor", function ()
        StackExchange.using("externalEditor", function ()
        StackExchange.using("snippets", function ()
        StackExchange.snippets.init();
        );
        );
        , "code-snippets");

        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "1"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );













        draft saved

        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55021278%2fhow-to-use-triple-quotes%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        2














        Add an r to your string



        gv_sixTries = r'''
        ___________.._______
        | .__________))______|
        | | / / ||
        | |/ / ||
        | | / ||.-''.
        | |/ |/ _
        | | || `/,|
        | | (\`_.'
        | | .-`--'.
        | | /Y . . Y
        | | // | | \
        | | // | . | \
        | | ') | | (`
        | | ||'||
        | | || ||
        | | || ||
        | | || ||
        | | / | |
        | | `-' `-'
        | |
        | |
        : :
        . .
        '''


        This tells python to use the string a raw literal, not using backslashes as escape characters






        share|improve this answer


















        • 1





          a bit faster than me, well done ;)

          – Tryph
          12 hours ago















        2














        Add an r to your string



        gv_sixTries = r'''
        ___________.._______
        | .__________))______|
        | | / / ||
        | |/ / ||
        | | / ||.-''.
        | |/ |/ _
        | | || `/,|
        | | (\`_.'
        | | .-`--'.
        | | /Y . . Y
        | | // | | \
        | | // | . | \
        | | ') | | (`
        | | ||'||
        | | || ||
        | | || ||
        | | || ||
        | | / | |
        | | `-' `-'
        | |
        | |
        : :
        . .
        '''


        This tells python to use the string a raw literal, not using backslashes as escape characters






        share|improve this answer


















        • 1





          a bit faster than me, well done ;)

          – Tryph
          12 hours ago













        2












        2








        2







        Add an r to your string



        gv_sixTries = r'''
        ___________.._______
        | .__________))______|
        | | / / ||
        | |/ / ||
        | | / ||.-''.
        | |/ |/ _
        | | || `/,|
        | | (\`_.'
        | | .-`--'.
        | | /Y . . Y
        | | // | | \
        | | // | . | \
        | | ') | | (`
        | | ||'||
        | | || ||
        | | || ||
        | | || ||
        | | / | |
        | | `-' `-'
        | |
        | |
        : :
        . .
        '''


        This tells python to use the string a raw literal, not using backslashes as escape characters






        share|improve this answer













        Add an r to your string



        gv_sixTries = r'''
        ___________.._______
        | .__________))______|
        | | / / ||
        | |/ / ||
        | | / ||.-''.
        | |/ |/ _
        | | || `/,|
        | | (\`_.'
        | | .-`--'.
        | | /Y . . Y
        | | // | | \
        | | // | . | \
        | | ') | | (`
        | | ||'||
        | | || ||
        | | || ||
        | | || ||
        | | / | |
        | | `-' `-'
        | |
        | |
        : :
        . .
        '''


        This tells python to use the string a raw literal, not using backslashes as escape characters







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 13 hours ago









        MerigMerig

        36915




        36915







        • 1





          a bit faster than me, well done ;)

          – Tryph
          12 hours ago












        • 1





          a bit faster than me, well done ;)

          – Tryph
          12 hours ago







        1




        1





        a bit faster than me, well done ;)

        – Tryph
        12 hours ago





        a bit faster than me, well done ;)

        – Tryph
        12 hours ago













        0














        The problem comes from unwanted escaping of new line characters due to antislashes at the end of some lines.



        Simply declare a raw string by prefixing your string by r, and it will fix the problem.



        gv_sixTries = r'''
        ___________.._______
        | .__________))______|
        | | / / ||
        | |/ / ||
        | | / ||.-''.
        | |/ |/ _
        | | || `/,|
        | | (\`_.'
        | | .-`--'.
        | | /Y . . Y
        | | // | | \
        | | // | . | \
        | | ') | | (`
        | | ||'||
        | | || ||
        | | || ||
        | | || ||
        | | / | |
        | | `-' `-'
        | |
        | |
        : :
        . .
        '''





        share|improve this answer



























          0














          The problem comes from unwanted escaping of new line characters due to antislashes at the end of some lines.



          Simply declare a raw string by prefixing your string by r, and it will fix the problem.



          gv_sixTries = r'''
          ___________.._______
          | .__________))______|
          | | / / ||
          | |/ / ||
          | | / ||.-''.
          | |/ |/ _
          | | || `/,|
          | | (\`_.'
          | | .-`--'.
          | | /Y . . Y
          | | // | | \
          | | // | . | \
          | | ') | | (`
          | | ||'||
          | | || ||
          | | || ||
          | | || ||
          | | / | |
          | | `-' `-'
          | |
          | |
          : :
          . .
          '''





          share|improve this answer

























            0












            0








            0







            The problem comes from unwanted escaping of new line characters due to antislashes at the end of some lines.



            Simply declare a raw string by prefixing your string by r, and it will fix the problem.



            gv_sixTries = r'''
            ___________.._______
            | .__________))______|
            | | / / ||
            | |/ / ||
            | | / ||.-''.
            | |/ |/ _
            | | || `/,|
            | | (\`_.'
            | | .-`--'.
            | | /Y . . Y
            | | // | | \
            | | // | . | \
            | | ') | | (`
            | | ||'||
            | | || ||
            | | || ||
            | | || ||
            | | / | |
            | | `-' `-'
            | |
            | |
            : :
            . .
            '''





            share|improve this answer













            The problem comes from unwanted escaping of new line characters due to antislashes at the end of some lines.



            Simply declare a raw string by prefixing your string by r, and it will fix the problem.



            gv_sixTries = r'''
            ___________.._______
            | .__________))______|
            | | / / ||
            | |/ / ||
            | | / ||.-''.
            | |/ |/ _
            | | || `/,|
            | | (\`_.'
            | | .-`--'.
            | | /Y . . Y
            | | // | | \
            | | // | . | \
            | | ') | | (`
            | | ||'||
            | | || ||
            | | || ||
            | | || ||
            | | / | |
            | | `-' `-'
            | |
            | |
            : :
            . .
            '''






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 13 hours ago









            TryphTryph

            1,9541022




            1,9541022





















                0














                The error comes due to a backslash character in the string which is used for printing escape sequence characters(n, t, , etc.). Use raw string for printing a backslash character on the screen, something like:



                gv_Tries = r"""
                ___________.._______
                | .__________))______|
                | | / / ||
                | |/ / ||
                | | / ||.-''.
                | |/ |/ _
                | | || `/,|
                | | (\`_.'
                | | .-`--'.
                | | /Y . . Y
                | | // | | \
                | | // | . | \
                | | ') | | (`
                | | ||'||
                | | || ||
                | | || ||
                | | || ||
                | | / | |
                | | `-' `-'
                | |
                | |
                : :
                . .
                """





                share|improve this answer



























                  0














                  The error comes due to a backslash character in the string which is used for printing escape sequence characters(n, t, , etc.). Use raw string for printing a backslash character on the screen, something like:



                  gv_Tries = r"""
                  ___________.._______
                  | .__________))______|
                  | | / / ||
                  | |/ / ||
                  | | / ||.-''.
                  | |/ |/ _
                  | | || `/,|
                  | | (\`_.'
                  | | .-`--'.
                  | | /Y . . Y
                  | | // | | \
                  | | // | . | \
                  | | ') | | (`
                  | | ||'||
                  | | || ||
                  | | || ||
                  | | || ||
                  | | / | |
                  | | `-' `-'
                  | |
                  | |
                  : :
                  . .
                  """





                  share|improve this answer

























                    0












                    0








                    0







                    The error comes due to a backslash character in the string which is used for printing escape sequence characters(n, t, , etc.). Use raw string for printing a backslash character on the screen, something like:



                    gv_Tries = r"""
                    ___________.._______
                    | .__________))______|
                    | | / / ||
                    | |/ / ||
                    | | / ||.-''.
                    | |/ |/ _
                    | | || `/,|
                    | | (\`_.'
                    | | .-`--'.
                    | | /Y . . Y
                    | | // | | \
                    | | // | . | \
                    | | ') | | (`
                    | | ||'||
                    | | || ||
                    | | || ||
                    | | || ||
                    | | / | |
                    | | `-' `-'
                    | |
                    | |
                    : :
                    . .
                    """





                    share|improve this answer













                    The error comes due to a backslash character in the string which is used for printing escape sequence characters(n, t, , etc.). Use raw string for printing a backslash character on the screen, something like:



                    gv_Tries = r"""
                    ___________.._______
                    | .__________))______|
                    | | / / ||
                    | |/ / ||
                    | | / ||.-''.
                    | |/ |/ _
                    | | || `/,|
                    | | (\`_.'
                    | | .-`--'.
                    | | /Y . . Y
                    | | // | | \
                    | | // | . | \
                    | | ') | | (`
                    | | ||'||
                    | | || ||
                    | | || ||
                    | | || ||
                    | | / | |
                    | | `-' `-'
                    | |
                    | |
                    : :
                    . .
                    """






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 12 hours ago









                    windstormwindstorm

                    357




                    357





















                        0














                        The problem is because some of your lines end with the Python escape character: .




                        The backslash () character is used to escape characters that otherwise have a special meaning, such as newline, backslash itself, or the quote character.



                        String and Bytes literals




                        When a line ends with a backslash, it tells Python that the line is continued on the next line.



                        if some_condition 
                        or some_other_condition:


                        To counter this, you either want to 'double up' your backslashes to escape your escape characters:



                        gv_sixTries = '''
                        | | /Y . . Y\
                        | | // | | \\
                        | | // | . | \\
                        '''


                        Or mark your string with an r to mark it as a raw string.




                        Both string and bytes literals may optionally be prefixed with a letter 'r' or 'R'; such strings are called raw strings and treat backslashes as literal characters.



                        String and Bytes literals




                        gv_sixTries = r'''
                        | | /Y . . Y
                        | | // | | \
                        | | // | . | \
                        '''





                        share|improve this answer



























                          0














                          The problem is because some of your lines end with the Python escape character: .




                          The backslash () character is used to escape characters that otherwise have a special meaning, such as newline, backslash itself, or the quote character.



                          String and Bytes literals




                          When a line ends with a backslash, it tells Python that the line is continued on the next line.



                          if some_condition 
                          or some_other_condition:


                          To counter this, you either want to 'double up' your backslashes to escape your escape characters:



                          gv_sixTries = '''
                          | | /Y . . Y\
                          | | // | | \\
                          | | // | . | \\
                          '''


                          Or mark your string with an r to mark it as a raw string.




                          Both string and bytes literals may optionally be prefixed with a letter 'r' or 'R'; such strings are called raw strings and treat backslashes as literal characters.



                          String and Bytes literals




                          gv_sixTries = r'''
                          | | /Y . . Y
                          | | // | | \
                          | | // | . | \
                          '''





                          share|improve this answer

























                            0












                            0








                            0







                            The problem is because some of your lines end with the Python escape character: .




                            The backslash () character is used to escape characters that otherwise have a special meaning, such as newline, backslash itself, or the quote character.



                            String and Bytes literals




                            When a line ends with a backslash, it tells Python that the line is continued on the next line.



                            if some_condition 
                            or some_other_condition:


                            To counter this, you either want to 'double up' your backslashes to escape your escape characters:



                            gv_sixTries = '''
                            | | /Y . . Y\
                            | | // | | \\
                            | | // | . | \\
                            '''


                            Or mark your string with an r to mark it as a raw string.




                            Both string and bytes literals may optionally be prefixed with a letter 'r' or 'R'; such strings are called raw strings and treat backslashes as literal characters.



                            String and Bytes literals




                            gv_sixTries = r'''
                            | | /Y . . Y
                            | | // | | \
                            | | // | . | \
                            '''





                            share|improve this answer













                            The problem is because some of your lines end with the Python escape character: .




                            The backslash () character is used to escape characters that otherwise have a special meaning, such as newline, backslash itself, or the quote character.



                            String and Bytes literals




                            When a line ends with a backslash, it tells Python that the line is continued on the next line.



                            if some_condition 
                            or some_other_condition:


                            To counter this, you either want to 'double up' your backslashes to escape your escape characters:



                            gv_sixTries = '''
                            | | /Y . . Y\
                            | | // | | \\
                            | | // | . | \\
                            '''


                            Or mark your string with an r to mark it as a raw string.




                            Both string and bytes literals may optionally be prefixed with a letter 'r' or 'R'; such strings are called raw strings and treat backslashes as literal characters.



                            String and Bytes literals




                            gv_sixTries = r'''
                            | | /Y . . Y
                            | | // | | \
                            | | // | . | \
                            '''






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 12 hours ago









                            alxwrdalxwrd

                            1,242720




                            1,242720



























                                draft saved

                                draft discarded
















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55021278%2fhow-to-use-triple-quotes%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                1928 у кіно

                                Захаров Федір Захарович

                                Ель Греко