#! /usr/bin/env python # def s_quote ( s1, mark ): #*****************************************************************************80 # ## S_QUOTE "quotes" a string. # # Discussion: # # Actually, it simply puts the string MARK before and after the string S1. # # Sometimes, when you print a string, you want to put quote marks around it. # This is one way to do that. # # Examples: # # S1 MARK S2 # -------- ---- ---------- # Hi, Bob! " "Hi, Bob!" # De Loop LoopDeLoop # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 30 January 2016 # # Author: # # John Burkardt # # Parameters: # # Input, string S1, a string to be "quoted". # # Input, string MARK, the "quote mark". # # Output, string S2, the "quoted" string. # s2 = mark + s1 + mark return s2 def s_quote_test ( ): #*****************************************************************************80 # ## S_QUOTE_TEST tests S_QUOTE. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 30 January 2016 # # Author: # # John Burkardt # import platform print ( '' ) print ( 'S_QUOTE_TEST' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' S_QUOTE quotes a string S1 with a mark MARK.' ) print ( '' ) print ( ' ----S1---- ---MARK--- ----S2----' ) print ( '' ) s1 = 'Hi, Bob!' mark = '"' s2 = s_quote ( s1, mark ) print ( ' %-10s %-10s %-10s' % ( s1, mark, s2 ) ) s1 = 'De' mark = 'Loop' s2 = s_quote ( s1, mark ) print ( ' %-10s %-10s %-10s' % ( s1, mark, s2 ) ) # # Terminate. # print ( '' ) print ( 'S_QUOTE_TEST' ) print ( ' Normal end of execution.' ) return if ( __name__ == '__main__' ): from timestamp import timestamp timestamp ( ) s_quote_test ( ) timestamp ( )