User:Federico: Difference between revisions
No edit summary |
|||
Line 31: | Line 31: | ||
==Prototy-ping pong== | ==Prototy-ping pong== | ||
===#1=== | |||
Since I do not like the first article of italian constitution that says <blockquote><i>"Italy is a Democratic Republic, founded on work"</i></blockquote> | |||
<syntaxhighlight lang="python"> | |||
import random #otherwise random does not work :) | |||
#first parts of the first 12 articles of the italian constitutes | |||
it_articles = ["\n\nART.1 \nItaly is a Democratic Republic, founded", 'ART.2 \nThe Republic recognises and guarantees', 'ART.3 \nAll citizens have equal social dignity and are','ART.4 \nThe Republic recognises the right of all citizens to','ART.5 \nThe Republic, one and indivisible, recognises and promotes','ART.6 \nThe Republic shall protect','ART.7 \nThe State and the Catholic Church are','ART.8 \nAll religious confessions enjoy','ART.9 \nThe Republic shall promote the development of','ART.10 \nThe Italian legal system conforms to the generally recognised rules of','ART.11 \nItaly rejects war as an instrument of','ART.12 \nThe flag of the Republic is'] | |||
with open("Utopia.txt") as utopia: #open the external .txt | |||
contents = utopia.read().replace('\n',' ').replace('\r ', '').replace('-','').replace(' ',' ').strip(' and ')#delete useless breaks | |||
with open("anarchist_cookbook.txt") as cookbook: | |||
contents2 = cookbook.read().replace('\n', ' ').replace('\r', '').strip('1234567890').replace('-','').replace(' ',' ').strip(' and ') | |||
utopia_splitted = contents.split("," or "." or '"' or '; ' or 'and') #splits the texts and makes a list | |||
cookbook_splitted = contents2.split("," or "." or '"' or '; ' or 'and') | |||
export = './export.txt' | |||
with open(export, 'w') as export: #This creates a txt file | |||
for i in range(5): #creates more possibilities, change the value to have more or less results | |||
for x in range(12): | |||
utopia_random = random.choice(utopia_splitted) #it takes a random sentence from the list | |||
cookbook_random = random.choice(cookbook_splitted) | |||
constitute = it_articles[x] #it prints in order the articles | |||
speculative_constitute = constitute + (utopia_random or cookbook_random) | |||
export.write(f"{speculative_constitute}.\n \n") #This prints on txt the results | |||
print(f'''{speculative_constitute}.\n''') | |||
</syntaxhighlight> | |||
Here the results | |||
===#2=== | |||
Revision as of 19:17, 29 September 2020
Federico or Poni who likes pigeons and purple and fans of computers and unzipping folders
Federico or Poni who doesn't like capitalism and yellow and labour and php
The Magic First Year
Prototy-ping pong
#1
Since I do not like the first article of italian constitution that says
"Italy is a Democratic Republic, founded on work"
import random #otherwise random does not work :)
#first parts of the first 12 articles of the italian constitutes
it_articles = ["\n\nART.1 \nItaly is a Democratic Republic, founded", 'ART.2 \nThe Republic recognises and guarantees', 'ART.3 \nAll citizens have equal social dignity and are','ART.4 \nThe Republic recognises the right of all citizens to','ART.5 \nThe Republic, one and indivisible, recognises and promotes','ART.6 \nThe Republic shall protect','ART.7 \nThe State and the Catholic Church are','ART.8 \nAll religious confessions enjoy','ART.9 \nThe Republic shall promote the development of','ART.10 \nThe Italian legal system conforms to the generally recognised rules of','ART.11 \nItaly rejects war as an instrument of','ART.12 \nThe flag of the Republic is']
with open("Utopia.txt") as utopia: #open the external .txt
contents = utopia.read().replace('\n',' ').replace('\r ', '').replace('-','').replace(' ',' ').strip(' and ')#delete useless breaks
with open("anarchist_cookbook.txt") as cookbook:
contents2 = cookbook.read().replace('\n', ' ').replace('\r', '').strip('1234567890').replace('-','').replace(' ',' ').strip(' and ')
utopia_splitted = contents.split("," or "." or '"' or '; ' or 'and') #splits the texts and makes a list
cookbook_splitted = contents2.split("," or "." or '"' or '; ' or 'and')
export = './export.txt'
with open(export, 'w') as export: #This creates a txt file
for i in range(5): #creates more possibilities, change the value to have more or less results
for x in range(12):
utopia_random = random.choice(utopia_splitted) #it takes a random sentence from the list
cookbook_random = random.choice(cookbook_splitted)
constitute = it_articles[x] #it prints in order the articles
speculative_constitute = constitute + (utopia_random or cookbook_random)
export.write(f"{speculative_constitute}.\n \n") #This prints on txt the results
print(f'''{speculative_constitute}.\n''')
Here the results
#2
Issue 13
https://pad.xpub.nl/p/Tense%2C_Practical_Vision%2C_Eco-Swaraj
Ground 0: Conflicts & Consens with Eleonor
Maybe you wanna know what I do
- Here my web, hope to have time to develope my new one
- Here un * salta web, not yet mobile-friendly neither in english but still 😎
- Here my are.na