Python
  Home arrow Python arrow Page 2 - Python: Stringing You Along
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
IBM Rational Software Development Conference
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PYTHON

Python: Stringing You Along
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 4
    2008-01-28

    Table of Contents:
  • Python: Stringing You Along
  • Making Text Appear Exactly As You Typed It
  • Other Ways to Span Text
  • String Operators

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    TestComplete™ automates software testing for a fraction of what the big guys charge. Easy functional and load testing for all Windows, .NET, Java and Web apps. Download a free trial now.

    Python: Stringing You Along - Making Text Appear Exactly As You Typed It
    (Page 2 of 4 )


    #!/usr/local/bin/python

    two_cities= """

      It was the best of times, it was the worst of times, it was the age of  wisdom,

    it was the age of

         foolishness

    it was the epoch of belief, it was the epoch of incredulity, it was the               season

         of Light, it was the season

               of Darkness,

    it was the spring of hope, it was the winter of despair, we had everything

    before us,

       we had nothing

    before us,

      we were all going direct to heaven, we were all going direct the

    other way-

    in short, the period was so far like the present period, that some

      of its noisiest

    authorities

    insisted on its being received, for good or for evil, in the superlative

      degree

    of comparison

      only.

    """

    print "Look out! Dickens is back!"

    print " "

    print two_cities

    The result of this code:

    Look out! Dickens is back!

     

      It was the best of times, it was the worst of times, it was the age of wisdom,

    it was the age of

         foolishness

    it was the epoch of belief, it was the epoch of incredulity, it was the season

    of Light, it was the                    season

                                    of Darkness,

    it was the spring of hope, it was the winter of despair, we had everything

      before us,

    we had nothing

      before us,

    we were all going direct to heaven, we were all going direct the

    other way-

    in short, the period was so far like the present period, that some

      of its noisiest

                  authorities

    insisted on its being received, for good or for evil, in the superlative

              degree

    of comparison

             only.


    More Python Articles
    More By James Payne


       · Thanks for dropping by to read my article on Python strings. In this episode we...
       · Thanks for the article, but the text spanning examples are broken. The backslashes...
       · Hey, thanks for catching that; our content system sometimes gobbles up our...
       · I fixed the article as well. Thanks.-James Payne
     

       

    PYTHON ARTICLES

    - SSH with Twisted
    - Mobile Programming in Python using PyS60: UI...
    - Python: Count on It
    - Python Strings: Spinning Yarns
    - Python: More Fun with Strings
    - Python: Stringing You Along
    - Python Operators
    - Bluetooth Programming in Python: Network Pro...
    - Python Sets
    - Python Conditionals, Lists, Dictionaries, an...
    - Python: Input and Variables
    - Introduction to Python Programming
    - Mobile Programming in Python using PyS60: Ge...
    - Bluetooth Programming using Python
    - Finishing the PyMailGUI Client: User Help To...




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway