What does % do to strings in Python? [closed]Meanings of percent sign(%)What does the modulus symbol do here?What does this code “%.8f”% do in python?What does percentage sign do in python if not working as a moduleHow to use % symbol correctlyPython - open(filename(n))What is the difference between String and string in C#?What are metaclasses in Python?What does the “yield” keyword do?Does Python have a ternary conditional operator?How to substring a string in Python?What is the !! (not not) operator in JavaScript?What is the “-->” operator in C++?How to check whether a string contains a substring in JavaScript?Does Python have a string 'contains' substring method?Reference — What does this symbol mean in PHP?

Has a commercial or military jet bi-plane ever been manufactured?

How do I, as a DM, handle a party that decides to set up an ambush in a dungeon?

Copy previous line to current line from text file

Start job from another SQL server instance

As a GM, is it bad form to ask for a moment to think when improvising?

How to pass hash as password to ssh server

Why is my arithmetic with a long long int behaving this way?

Handling Null values (and equivalents) routinely in Python

My first c++ game (snake console game)

Is there a word for food that's gone 'bad', but is still edible?

Dangerous workplace travelling

Which sphere is fastest?

Mug and wireframe entirely disappeared

Endgame puzzle: How to avoid stalemate and win?

Why is "breaking the mould" positively connoted?

Why do people keep telling me that I am a bad photographer?

What was Bran's plan to kill the Night King?

History of the kernel of a homomorphism?

Can my 2 children, aged 10 and 12, who are US citizens, travel to the USA on expired American passports?

Gerrymandering Puzzle - Rig the Election

How should I tell my manager I'm not paying for an optional after work event I'm not going to?

Why did WWI include Japan?

Voltage Balun 1:1

Is disk brake effectiveness mitigated by tyres losing traction under strong braking?



What does % do to strings in Python? [closed]


Meanings of percent sign(%)What does the modulus symbol do here?What does this code “%.8f”% do in python?What does percentage sign do in python if not working as a moduleHow to use % symbol correctlyPython - open(filename(n))What is the difference between String and string in C#?What are metaclasses in Python?What does the “yield” keyword do?Does Python have a ternary conditional operator?How to substring a string in Python?What is the !! (not not) operator in JavaScript?What is the “-->” operator in C++?How to check whether a string contains a substring in JavaScript?Does Python have a string 'contains' substring method?Reference — What does this symbol mean in PHP?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








21















I have failed to find documentation for the operator % as it is used on strings in Python. What does this operator do when it is used with a string on the left hand side?










share|improve this question















closed as off-topic by Mogsdad, Robert Columbia, AdrianHHH, kayess, FrankerZ Jan 15 '18 at 16:03


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Mogsdad, Robert Columbia, AdrianHHH, kayess, FrankerZ
If this question can be reworded to fit the rules in the help center, please edit the question.






















    21















    I have failed to find documentation for the operator % as it is used on strings in Python. What does this operator do when it is used with a string on the left hand side?










    share|improve this question















    closed as off-topic by Mogsdad, Robert Columbia, AdrianHHH, kayess, FrankerZ Jan 15 '18 at 16:03


    This question appears to be off-topic. The users who voted to close gave this specific reason:


    • "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Mogsdad, Robert Columbia, AdrianHHH, kayess, FrankerZ
    If this question can be reworded to fit the rules in the help center, please edit the question.


















      21












      21








      21


      2






      I have failed to find documentation for the operator % as it is used on strings in Python. What does this operator do when it is used with a string on the left hand side?










      share|improve this question
















      I have failed to find documentation for the operator % as it is used on strings in Python. What does this operator do when it is used with a string on the left hand side?







      python string documentation operators






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited yesterday









      BeeOnRope

      27k885186




      27k885186










      asked Aug 6 '09 at 11:29









      Ram RachumRam Rachum

      26.5k63185302




      26.5k63185302




      closed as off-topic by Mogsdad, Robert Columbia, AdrianHHH, kayess, FrankerZ Jan 15 '18 at 16:03


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Mogsdad, Robert Columbia, AdrianHHH, kayess, FrankerZ
      If this question can be reworded to fit the rules in the help center, please edit the question.







      closed as off-topic by Mogsdad, Robert Columbia, AdrianHHH, kayess, FrankerZ Jan 15 '18 at 16:03


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Mogsdad, Robert Columbia, AdrianHHH, kayess, FrankerZ
      If this question can be reworded to fit the rules in the help center, please edit the question.






















          4 Answers
          4






          active

          oldest

          votes


















          32














          It's the string formatting operator. Read up on string formatting in Python.



          format % values


          Creates a string where format specifies a format and values are the values to be filled in.






          share|improve this answer
































            7














            It applies printf-like formatting to a string, so that you can substitute certain parts of a string with values of variables.
            Example



            # assuming numFiles is an int variable
            print "Found %d files" % (numFiles, )


            See the link provided by Konrad






            share|improve this answer






























              6














              The '%' operator is used for string interpolation. Since Python 2.6 the String method "format" is used insted. For details see http://www.python.org/dev/peps/pep-3101/






              share|improve this answer






























                5














                Note that starting from Python 2.6, it's recommended to use the new str.format() method:



                >>> "The sum of 1 + 2 is 0".format(1+2)
                'The sum of 1 + 2 is 3'


                If you are using 2.6, you may want to keep using % in order to remain compatible with older versions, but in Python 3 there's no reason not to use str.format().






                share|improve this answer




















                • 2





                  format() is really powerful too. You can use named tags like "Hello planet".format(planet='earth')

                  – aehlke
                  Aug 6 '09 at 14:27

















                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                32














                It's the string formatting operator. Read up on string formatting in Python.



                format % values


                Creates a string where format specifies a format and values are the values to be filled in.






                share|improve this answer





























                  32














                  It's the string formatting operator. Read up on string formatting in Python.



                  format % values


                  Creates a string where format specifies a format and values are the values to be filled in.






                  share|improve this answer



























                    32












                    32








                    32







                    It's the string formatting operator. Read up on string formatting in Python.



                    format % values


                    Creates a string where format specifies a format and values are the values to be filled in.






                    share|improve this answer















                    It's the string formatting operator. Read up on string formatting in Python.



                    format % values


                    Creates a string where format specifies a format and values are the values to be filled in.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Nov 29 '16 at 17:48









                    phyatt

                    14.5k23254




                    14.5k23254










                    answered Aug 6 '09 at 11:30









                    Konrad RudolphKonrad Rudolph

                    406k1017961042




                    406k1017961042























                        7














                        It applies printf-like formatting to a string, so that you can substitute certain parts of a string with values of variables.
                        Example



                        # assuming numFiles is an int variable
                        print "Found %d files" % (numFiles, )


                        See the link provided by Konrad






                        share|improve this answer



























                          7














                          It applies printf-like formatting to a string, so that you can substitute certain parts of a string with values of variables.
                          Example



                          # assuming numFiles is an int variable
                          print "Found %d files" % (numFiles, )


                          See the link provided by Konrad






                          share|improve this answer

























                            7












                            7








                            7







                            It applies printf-like formatting to a string, so that you can substitute certain parts of a string with values of variables.
                            Example



                            # assuming numFiles is an int variable
                            print "Found %d files" % (numFiles, )


                            See the link provided by Konrad






                            share|improve this answer













                            It applies printf-like formatting to a string, so that you can substitute certain parts of a string with values of variables.
                            Example



                            # assuming numFiles is an int variable
                            print "Found %d files" % (numFiles, )


                            See the link provided by Konrad







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Aug 6 '09 at 11:38









                            Diaa SamiDiaa Sami

                            2,7292026




                            2,7292026





















                                6














                                The '%' operator is used for string interpolation. Since Python 2.6 the String method "format" is used insted. For details see http://www.python.org/dev/peps/pep-3101/






                                share|improve this answer



























                                  6














                                  The '%' operator is used for string interpolation. Since Python 2.6 the String method "format" is used insted. For details see http://www.python.org/dev/peps/pep-3101/






                                  share|improve this answer

























                                    6












                                    6








                                    6







                                    The '%' operator is used for string interpolation. Since Python 2.6 the String method "format" is used insted. For details see http://www.python.org/dev/peps/pep-3101/






                                    share|improve this answer













                                    The '%' operator is used for string interpolation. Since Python 2.6 the String method "format" is used insted. For details see http://www.python.org/dev/peps/pep-3101/







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Aug 6 '09 at 11:31







                                    lutz




























                                        5














                                        Note that starting from Python 2.6, it's recommended to use the new str.format() method:



                                        >>> "The sum of 1 + 2 is 0".format(1+2)
                                        'The sum of 1 + 2 is 3'


                                        If you are using 2.6, you may want to keep using % in order to remain compatible with older versions, but in Python 3 there's no reason not to use str.format().






                                        share|improve this answer




















                                        • 2





                                          format() is really powerful too. You can use named tags like "Hello planet".format(planet='earth')

                                          – aehlke
                                          Aug 6 '09 at 14:27















                                        5














                                        Note that starting from Python 2.6, it's recommended to use the new str.format() method:



                                        >>> "The sum of 1 + 2 is 0".format(1+2)
                                        'The sum of 1 + 2 is 3'


                                        If you are using 2.6, you may want to keep using % in order to remain compatible with older versions, but in Python 3 there's no reason not to use str.format().






                                        share|improve this answer




















                                        • 2





                                          format() is really powerful too. You can use named tags like "Hello planet".format(planet='earth')

                                          – aehlke
                                          Aug 6 '09 at 14:27













                                        5












                                        5








                                        5







                                        Note that starting from Python 2.6, it's recommended to use the new str.format() method:



                                        >>> "The sum of 1 + 2 is 0".format(1+2)
                                        'The sum of 1 + 2 is 3'


                                        If you are using 2.6, you may want to keep using % in order to remain compatible with older versions, but in Python 3 there's no reason not to use str.format().






                                        share|improve this answer















                                        Note that starting from Python 2.6, it's recommended to use the new str.format() method:



                                        >>> "The sum of 1 + 2 is 0".format(1+2)
                                        'The sum of 1 + 2 is 3'


                                        If you are using 2.6, you may want to keep using % in order to remain compatible with older versions, but in Python 3 there's no reason not to use str.format().







                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited Aug 6 '09 at 17:39

























                                        answered Aug 6 '09 at 12:40









                                        Bastien LéonardBastien Léonard

                                        46.3k177091




                                        46.3k177091







                                        • 2





                                          format() is really powerful too. You can use named tags like "Hello planet".format(planet='earth')

                                          – aehlke
                                          Aug 6 '09 at 14:27












                                        • 2





                                          format() is really powerful too. You can use named tags like "Hello planet".format(planet='earth')

                                          – aehlke
                                          Aug 6 '09 at 14:27







                                        2




                                        2





                                        format() is really powerful too. You can use named tags like "Hello planet".format(planet='earth')

                                        – aehlke
                                        Aug 6 '09 at 14:27





                                        format() is really powerful too. You can use named tags like "Hello planet".format(planet='earth')

                                        – aehlke
                                        Aug 6 '09 at 14:27



                                        Popular posts from this blog

                                        Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                                        Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                                        Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript