Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

basic python programme

  • 11-09-2011 10:08PM
    #1
    Registered Users, Registered Users 2 Posts: 27


    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...
    Tagged:


Comments

  • Closed Accounts Posts: 9,139 ✭✭✭-Trek-


    I think its the new line character your after "\n", i have included two ways of doing it, hope its what your looking for :)
    .
    >>> 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
    >>> 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
    >>>
    


  • Registered Users, Registered Users 2 Posts: 27 adrian7444


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

    i got the programme to do what i wanted:)

    adrian


Advertisement