administrata wrote:
Hello! :)
I've reading 'Python Programmin for the Absolute beginner'.
I got questions which is...

print "\t - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "

rock = """
Igneous          Sedimentary          Metamorphic

Lava             Grains               Marble
Ramdom crystals  Layer                Bands
Granite          Salt                 Schist
Intrusive        Weathering           Heat + Pressure
                 Deposition           Change"""
print \trock

print "\t - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "

error occurs!

I don't know how to \t The variable.

see Daniel's answer for the why.
Now for the how, I guess you want a tab on each line so you have two solutions :
1/ putting the tabs in the string:
rock = """
\tIgneous Sedimentary Metamorphic


\tLava             Grains               Marble
\tRamdom crystals  Layer                Bands
\tGranite          Salt                 Schist
\tIntrusive        Weathering           Heat + Pressure
\t                 Deposition           Change"""

print rock

2/ adding the tabs before printing:
rock = """
Igneous          Sedimentary          Metamorphic

Lava             Grains               Marble
Ramdom crystals  Layer                Bands
Granite          Salt                 Schist
Intrusive        Weathering           Heat + Pressure
                 Deposition           Change"""


for line in rock.split("\n"): print "\t%s" % line

HTH,
--
bruno desthuilliers
ruby -e "print '[EMAIL PROTECTED]'.split('@').collect{|p| p.split('.').collect{|w| w.reverse}.join('.')}.join('@')"
--
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to