Boards.ie uses cookies. By continuing to browse this site you are agreeing to our use of cookies. Click here to find out more x
Post Reply  
 
Thread Tools Search this Thread
11-09-2011, 22:08   #1
adrian7444
Registered User
 
Join Date: Sep 2011
Posts: 10
basic python programme

Full_address="Firstname + ''+Surname\
Address1\
Address2\
Address3\"
Hi,
i am looking for the syntax (if possible) to make the above work (i am getting syntax errors) so that i can save variables that i have created as a full block of output. I need to push the address onto the line below and not all on one line.
please help...
adrian7444 is offline  
Advertisement
11-09-2011, 22:46   #2
-Trek-
Closed Account
 
Join Date: Sep 2009
Posts: 4,248
I think its the new line character your after "\n", i have included two ways of doing it, hope its what your looking for

Code:
.
>>> first_name = "First"
>>> last_name = "Last"
>>> address1 = "Address one"
>>> address2 = "Address two"
>>> address3 = "Address three"
>>> print first_name + " " + last_name + "\n" + address1 + "\n" + address2 + "\n" + address3
First Last
Address one
Address two
Address three
>>>
or

Code:
>>> first_name = "First"
>>> last_name = "Last"
>>> address1 = "Address one"
>>> address2 = "Address two"
>>> address3 = "Address three"
>>> print "%s %s\n%s\n%s\n%s" % (first_name, last_name, address1, address2, address3)
First Last
Address one
Address two
Address three
>>>
-Trek- is offline  
12-09-2011, 14:08   #3
adrian7444
Registered User
 
Join Date: Sep 2011
Posts: 10
python

thank you for your help (and everyone who replied).......really appreciate all the assistance

i got the programme to do what i wanted

adrian
adrian7444 is offline  
Post Reply

Quick Reply
Message:
Remove Text Formatting
Bold
Italic
Underline

Insert Image
Wrap [QUOTE] tags around selected text
 
Decrease Size
Increase Size
Please sign up or log in to join the discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search