Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Python - Writing Text To File?  (Read 3500 times)

0 Members and 1 Guest are viewing this topic.

monkl

    Topic Starter


    Starter

    • Experience: Beginner
    • OS: Unknown
    Python - Writing Text To File?
    « on: January 17, 2012, 07:29:27 PM »
    How can I print something to a new file using python?
    I want to take variables a, b, and c and print them to a text file.
    Also, how to append if I want to add more?

    BC_Programmer


      Mastermind
    • Typing is no substitute for thinking.
    • Thanked: 1140
      • Yes
      • Yes
      • BC-Programming.com
    • Certifications: List
    • Computer: Specs
    • Experience: Beginner
    • OS: Windows 11
    Re: Python - Writing Text To File?
    « Reply #1 on: January 17, 2012, 07:53:07 PM »
    give this a look.

    Python docs: http://docs.python.org/tutorial/inputoutput.html

    Specifically, part 7.2

    Here's another tutorial as well:
    http://www.penzilla.net/tutorials/python/fileio/

    I was trying to dereference Null Pointers before it was cool.

    Squashman



      Specialist
    • Thanked: 134
    • Experience: Experienced
    • OS: Other
    Re: Python - Writing Text To File?
    « Reply #2 on: January 19, 2012, 07:35:27 AM »
    A great free Python Learning Book for all ages despite its title.
    http://www.briggs.net.nz/log/writing/snake-wrangling-for-kids/

    BC_Programmer


      Mastermind
    • Typing is no substitute for thinking.
    • Thanked: 1140
      • Yes
      • Yes
      • BC-Programming.com
    • Certifications: List
    • Computer: Specs
    • Experience: Beginner
    • OS: Windows 11
    Re: Python - Writing Text To File?
    « Reply #3 on: January 19, 2012, 12:07:04 PM »
    A great free Python Learning Book for all ages despite its title.
    http://www.briggs.net.nz/log/writing/snake-wrangling-for-kids/

    The problem with the title being of course that the name "Python" for the language has nothing to do with the animal...
    I was trying to dereference Null Pointers before it was cool.