ConwayLife.com - A community for Conway's Game of Life and related cellular automata
Home  •  LifeWiki  •  Forums  •  Download Golly

txt file writing

For scripts to aid with computation or simulation in cellular automata.

txt file writing

Postby wwei23 » July 16th, 2017, 2:57 pm

How do I get Python to write to a txt file?
Replicator!
x = 3, y = 3, rule = B3/S234y
2bo$3o$bo!
User avatar
wwei23
 
Posts: 642
Joined: May 22nd, 2017, 6:14 pm
Location: The (Life?) Universe

Re: txt file writing

Postby Sokwe » July 16th, 2017, 3:21 pm

Try googling "How do I get Python to write to a txt file?"
-Matthias Merzenich
Sokwe
Moderator
 
Posts: 1144
Joined: July 9th, 2009, 2:44 pm

Re: txt file writing

Postby Saka » July 16th, 2017, 7:30 pm

F = open("Blah.txt","w")
F.write("Uvuvwevwevwe")

If I remember correctly
Everyone, please stop posting B/S about CA
x = 17, y = 10, rule = B3/S23
b2ob2obo5b2o$11b4obo$2bob3o2bo2b3o$bo3b2o4b2o$o2bo2bob2o3b4o$bob2obo5b
o2b2o$2b2o4bobo2b3o$bo3b5ob2obobo$2bo5bob2o$4bob2o2bobobo!

(Check gen 2)
User avatar
Saka
 
Posts: 2182
Joined: June 19th, 2015, 8:50 pm
Location: In the kingdom of Sultan Hamengkubuwono X

Re: txt file writing

Postby drc » July 16th, 2017, 8:14 pm

Saka wrote:Uvuvwevwevwe


Wow that's a really obscure reference(?), nice job.
This post was brought to you by the letter D, for dishes that Andrew J. Wade won't do. (Also Daniel, which happens to be me.)
Current rule interest: B2ce3-ir4a5y/S2-c3-y
User avatar
drc
 
Posts: 1665
Joined: December 3rd, 2015, 4:11 pm
Location: creating useless things in OCA

Re: txt file writing

Postby dvgrn » July 16th, 2017, 9:56 pm

Golly's shift.py/lua and goto.py/lua both remember previously used numbers by reading and writing to specific text files in Golly's data folder. Just right-click on those scripts for a reminder of how the syntax works.
dvgrn
Moderator
 
Posts: 3988
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI

Re: txt file writing

Postby Saka » July 17th, 2017, 5:02 am

drc wrote:
Saka wrote:Uvuvwevwevwe


Wow that's a really obscure reference(?), nice job.

When I look for a text spacefiller I always get what comes out fresh from the lump of dead stuff that makes me living.
Everyone, please stop posting B/S about CA
x = 17, y = 10, rule = B3/S23
b2ob2obo5b2o$11b4obo$2bob3o2bo2b3o$bo3b2o4b2o$o2bo2bob2o3b4o$bob2obo5b
o2b2o$2b2o4bobo2b3o$bo3b5ob2obobo$2bo5bob2o$4bob2o2bobobo!

(Check gen 2)
User avatar
Saka
 
Posts: 2182
Joined: June 19th, 2015, 8:50 pm
Location: In the kingdom of Sultan Hamengkubuwono X

Re: txt file writing

Postby Naszvadi » July 17th, 2017, 6:54 am

This topic is a candidate for being moved to ../forums/viewforum.php?f=12 a.k.a. Sandbox.
Naszvadi
 
Posts: 182
Joined: May 7th, 2016, 8:53 am


Return to Scripts

Who is online

Users browsing this forum: No registered users and 2 guests