Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.04; 'perl,': 0.05; 'python': 0.08; 'to:addr:comp.lang.python': 0.09; 'subject:python': 0.10; '2.7.2': 0.16; 'ast,': 0.16; 'cc:addr :python-list': 0.16; 'wrote:': 0.18; 'later': 0.19; 'seems': 0.20; 'programming': 0.20; "haven't": 0.20; 'cc:no real name:2**0': 0.21; 'trying': 0.21; 'header:In-Reply-To:1': 0.22; 'string': 0.24; "python's": 0.24; 'suspect': 0.24; 'cc:2**0': 0.26; 'code.': 0.26; 'code': 0.26; "i'm": 0.28; 'class': 0.29; 'cc:addr:python.org': 0.29; 'rarely': 0.30; 'subject:source': 0.30; 'from:addr:googlemail.com': 0.31; 'translate': 0.31; 'actually': 0.31; 'file.': 0.31; 'there': 0.33; 'header:User- Agent:1': 0.33; 'file': 0.34; 'realize': 0.34; 'but': 0.37; 'received:google.com': 0.37; 'using': 0.37; 'subject:with': 0.37; 'received:209.85': 0.38; 'could': 0.38; 'that.': 0.39; 'received:209': 0.39; 'user': 0.40; 'due': 0.66; 'fit.': 0.67; '8bit%:62': 0.77; 'subject:write': 0.84; 'skip:2 50': 0.91 Received-SPF: pass (google.com: domain of dihedral88888@googlemail.com designates 10.68.243.208 as permitted sender) client-ip=10.68.243.208; Authentication-Results: mr.google.com; spf=pass (google.com: domain of dihedral88888@googlemail.com designates 10.68.243.208 as permitted sender) smtp.mail=dihedral88888@googlemail.com Newsgroups: comp.lang.python Date: Tue, 28 Feb 2012 10:09:50 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=112.105.143.185; posting-account=5JdMBQoAAABHnS4mjpqEzxnmWtgiiVNw References: <23135461.7.1330450584442.JavaMail.geo-discussion-forums@pbcrt4> User-Agent: G2/1.0 X-Google-Web-Client: true MIME-Version: 1.0 Subject: Re: Need to write python source with python From: 88888 Dihedral To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1330452593 news.xs4all.nl 6966 [2001:888:2000:d::a6]:46463 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:20991 =E5=9C=A8 2012=E5=B9=B42=E6=9C=8829=E6=97=A5=E6=98=9F=E6=9C=9F=E4=B8=89UTC+= 8=E4=B8=8A=E5=8D=881=E6=97=B656=E5=88=8643=E7=A7=92=EF=BC=8CPeter Otten=E5= =86=99=E9=81=93=EF=BC=9A > crstop@gmail.com wrote: >=20 > > I'm new to Python but have experience with a few other programming > > languages(Java, Perl, JavaScript). > >=20 > > I'm using Python 2.7.2 and I'm trying to create and write to a file (.p= y) > > a python class and functions from python. I will also need to later rea= d > > and edit the file. I realize I could just write strings using the > > available string and file writing methods but suspect there is a better > > way than that. > >=20 > > I have read about pickle, ast, and Django; searched this group and the = web > > but haven't found a solution that seems to fit. Any suggestion? >=20 > Due to Python's dynamic nature it is rarely necessary to generate Python= =20 > code. What are you actually trying to achieve? Check myHDL, and BOA and pythoncard that can translate user messages to pyhton code as delphie.