User:Euna/prototyping 13: Difference between revisions
No edit summary |
No edit summary |
||
Line 18: | Line 18: | ||
<b>Notebook</b> | <b> Notebook </b> | ||
- for hybrid publishing interface (but +, console) <br> | - for hybrid publishing interface (but +, console) <br> | ||
Line 26: | Line 26: | ||
<b>Phython code</b> | <b> Phython code </b> | ||
- https://docs.python.org/3/tutorial/classes.html#class-objects <br> | - https://docs.python.org/3/tutorial/classes.html#class-objects <br> | ||
Line 113: | Line 113: | ||
= Prototyping 2 (28/09/2020) = | |||
== JupiterLab == | |||
<b> Terminal </b> | |||
- Console where can test python language locally | |||
- easily access to local file | |||
<pre> | |||
type "python3" + enter #not the version 2.7! | |||
exit() #to finish | |||
</pre> | |||
<b> Phython code </b> | |||
- b=str(3) = c="3" | |||
- "software" != "Software" (for Python, uppercase and lowercase are different string) | |||
- a.replace ('soft','hard) | |||
- a. + tab -> shows what we can chose after "." | |||
- \(back slash) is used to escape characters | |||
<source lang=python> | |||
print('Euna's cookie') #Error, cause after a, is already closed | |||
print('Euna\'s cookie') #output, Euna's cookie | |||
a = "\\" | |||
print(a) #output, \ | |||
</source> | |||
== Pattern == | |||
- Both early code and weaving pattern used punch card -> making pattern! | |||
- Pattern 1 | |||
<source lang=python> | |||
import random | |||
characters = ['╱','╲'] #if you do with '/','\' use '/','\\' | |||
width = 100 | |||
height = 50 | |||
line = '' | |||
for y in range(height): | |||
for x in range(width): | |||
line += random.choice(characters) | |||
print(line) | |||
line = '' | |||
</source> | |||
<pre> | |||
╱╲╲╱╱╱╲╱╲╱╲╲╲╲╲╲╱╱╲╲╲╲╱╱╲╲╲╱╲╱╲╱╱╱╲╲╲╲╲╱╲╱╲╱╱╲╱╲╱╱ | |||
╲╲╲╱╱╲╱╱╱╲╲╱╲╲╱╱╱╱╱╲╲╲╲╲╲╲╲╲╱╱╱╱╲╱╱╱╲╱╱╲╱╱╲╱╱╲╱╲╱╱ | |||
╲╲╱╱╲╲╱╲╲╱╲╱╱╲╱╱╲╱╲╱╱╲╱╱╲╲╲╲╱╱╲╱╱╲╲╲╱╱╲╲╲╲╲╱╲╱╲╲╲╲ | |||
╲╱╲╲╱╱╲╲╲╱╲╲╲╱╲╱╱╲╲╲╱╱╲╱╱╲╱╲╲╲╲╱╱╲╲╲╱╱╲╲╱╱╱╱╱╱╱╲╱╲ | |||
╲╱╲╱╱╲╱╲╲╲╲╱╲╲╱╱╲╱╱╱╱╱╲╲╲╱╱╲╱╲╱╱╱╱╱╲╱╱╱╱╲╲╲╲╲╱╲╲╱╲ | |||
╱╲╱╱╱╲╲╱╱╲╱╱╱╱╱╱╲╲╱╲╲╱╱╱╱╱╲╲╲╱╲╲╱╲╱╱╲╲╲╲╱╲╲╲╲╱╱╱╱╲ | |||
╱╲╲╱╲╲╱╲╲╱╲╲╲╲╱╲╲╱╱╲╲╱╲╲╲╲╲╲╲╲╲╱╱╱╱╱╱╱╲╲╱╲╱╲╱╱╲╲╱╱ | |||
╲╲╱╲╲╱╲╲╱╲╱╲╱╱╲╱╱╲╱╲╱╲╲╲╱╲╱╱╲╲╲╲╲╱╱╲╲╲╱╲╱╲╲╲╲╲╲╲╲╲ | |||
╲╲╱╲╱╲╱╲╲╲╲╲╱╲╲╲╲╲╱╱╲╲╱╱╱╱╲╱╲╲╲╲╲╲╱╱╱╱╱╱╱╱╲╲╲╱╲╱╲╱ | |||
╱╱╲╲╲╱╱╲╲╱╱╱╲╱╱╱╱╲╱╲╲╱╱╲╲╱╲╱╱╲╲╲╱╲╱╲╱╱╱╲╲╱╲╲╱╲╲╲╲╲ | |||
╱╱╲╱╲╱╲╱╱╲╲╱╲╲╱╲╱╲╱╱╲╲╱╱╱╲╲╱╱╱╲╲╱╲╱╲╱╲╱╲╱╱╲╱╲╲╲╲╱╱ | |||
╲╱╲╲╱╱╲╱╲╲╲╲╱╲╱╱╱╱╱╱╲╲╱╱╲╲╱╱╱╲╱╲╲╲╲╲╱╱╱╱╱╲╲╱╲╲╲╲╱╱ | |||
╱╲╱╱╱╲╱╱╲╱╱╲╱╱╱╲╲╲╲╱╱╲╲╱╱╱╲╱╱╲╱╱╲╲╱╱╱╱╲╱╲╲╲╱╲╱╲╲╲╲ | |||
╲╲╲╱╱╲╲╲╲╱╲╲╲╲╲╱╱╱╲╱╲╲╱╲╲╱╱╱╱╲╱╲╱╲╲╱╱╱╱╱╱╲╲╲╲╱╲╱╲╱ | |||
╲╲╱╲╲╲╲╲╲╱╱╲╱╱╲╲╱╱╲╱╲╲╲╱╲╲╱╱╲╲╱╲╲╱╱╱╱╱╲╲╱╱╱╲╲╱╲╱╱╱ | |||
╲╱╱╱╲╱╱╲╲╲╱╲╲╲╱╱╱╲╱╲╱╲╲╱╲╱╱╲╲╲╲╱╲╱╱╱╱╲╱╲╱╱╲╱╱╱╱╱╲╲ | |||
╱╲╱╱╲╱╱╱╱╱╲╲╱╱╲╱╲╱╱╲╱╲╱╱╱╱╲╱╱╱╱╲╱╲╲╱╲╱╱╱╲╱╱╱╲╱╲╱╲╲ | |||
╲╱╱╱╲╱╱╲╲╱╱╱╱╱╱╲╱╱╱╱╲╱╲╱╲╲╲╲╲╲╲╲╲╱╲╲╲╲╱╱╱╱╱╱╲╲╱╲╱╲ | |||
╲╱╲╱╱╱╱╱╲╱╲╲╱╱╲╲╱╲╲╱╲╲╲╱╲╱╱╲╲╱╲╱╲╲╲╲╲╱╲╲╱╱╲╱╱╲╲╱╱╲ | |||
╲╲╲╱╲╲╱╲╲╲╲╱╲╲╱╲╱╲╲╲╱╱╱╱╲╲╲╲╱╲╱╱╱╱╱╲╲╱╲╱╲╱╲╱╱╱╱╱╲╱ | |||
╲╲╱╱╱╲╱╱╲╱╱╲╱╲╱╱╱╲╱╲╱╲╱╲╱╲╲╱╱╲╱╲╱╱╲╱╱╱╲╱╲╱╱╲╱╲╱╱╲╲ | |||
╲╱╲╲╲╱╱╱╲╲╲╱╱╱╲╱╱╱╲╲╱╲╱╲╱╱╲╱╱╲╲╱╱╱╱╱╱╱╲╲╲╱╱╲╲╱╱╱╱╲ | |||
╱╲╲╲╲╲╱╲╲╱╲╲╱╱╱╲╱╲╱╱╱╲╲╱╲╲╱╱╲╱╲╱╱╲╲╲╲╲╱╲╱╲╱╲╱╱╱╱╱╲ | |||
╲╱╲╲╲╱╱╱╱╱╲╱╱╲╱╱╲╲╱╲╱╱╲╱╱╱╲╱╱╲╲╱╱╲╱╲╱╱╱╲╲╲╱╲╲╲╱╱╱╲ | |||
╲╲╲╱╲╱╲╱╲╱╱╱╱╲╲╲╱╱╲╱╲╲╲╱╱╲╱╱╲╲╲╲╲╱╱╲╱╲╲╱╱╱╲╱╲╱╲╲╲╱ | |||
</pre> | |||
- Pattern 2 | |||
<source lang=python> | |||
import random | |||
characters = ["c", "o", "c", "o"] | |||
width = 50 | |||
height = 25 | |||
line = '' | |||
for y in range(height): | |||
for x in range(width): | |||
line += random.choice(characters) #chose the letter randomly | |||
if 'coco' in line : | |||
print(line.replace('coco','🥥🥥🥥🥥')) #coconut emoji if it's combination of coco | |||
else : | |||
print(line) #if not, just print the chosen letter | |||
line = '' #reset, change the line | |||
</source> | |||
<pre> | |||
ccccoocoocoocoooc🥥🥥🥥🥥ococ🥥🥥🥥🥥cooocoo🥥🥥🥥🥥ococcooooc | |||
ooccooc🥥🥥🥥🥥occccccoooo🥥🥥🥥🥥c🥥🥥🥥🥥ccccoccooocc🥥🥥🥥🥥ccc | |||
coocooooooccoccc🥥🥥🥥🥥occoccc🥥🥥🥥🥥ccoc🥥🥥🥥🥥cooccooccoc | |||
🥥🥥🥥🥥o🥥🥥🥥🥥occ🥥🥥🥥🥥ooocoocooocc🥥🥥🥥🥥ccoocoocccccccoooo | |||
coocoooccc🥥🥥🥥🥥ococcocc🥥🥥🥥🥥cooccoccccccocccoc🥥🥥🥥🥥cc | |||
oocc🥥🥥🥥🥥coooocooooocooooccoc🥥🥥🥥🥥coocc🥥🥥🥥🥥oooo🥥🥥🥥🥥o | |||
occoococc🥥🥥🥥🥥ccocccoo🥥🥥🥥🥥oocoocoo🥥🥥🥥🥥occoooooooooc | |||
ccccoooo🥥🥥🥥🥥oooccooooccoc🥥🥥🥥🥥ooooccccc🥥🥥🥥🥥cocccooc | |||
🥥🥥🥥🥥cccccocccocccoccoo🥥🥥🥥🥥oooo🥥🥥🥥🥥ccooococ🥥🥥🥥🥥occo | |||
occoocccooo🥥🥥🥥🥥ooccoccoccoccoc🥥🥥🥥🥥occocccoc🥥🥥🥥🥥ooo | |||
c🥥🥥🥥🥥coccooocoooccooc🥥🥥🥥🥥occcoooooc🥥🥥🥥🥥ocooooooooc | |||
ooccooococcocccccoocoocc🥥🥥🥥🥥coccoocccooooocooocooo | |||
oo🥥🥥🥥🥥oocooccoccoccoccccoococcocccc🥥🥥🥥🥥oocoocooocc | |||
coooooc🥥🥥🥥🥥cooc🥥🥥🥥🥥🥥🥥🥥🥥coocooocoooocoococc🥥🥥🥥🥥ocoo | |||
oooccooc🥥🥥🥥🥥cocc🥥🥥🥥🥥oo🥥🥥🥥🥥ccooocccccccoococ🥥🥥🥥🥥cco | |||
cooo🥥🥥🥥🥥oococccoooocooccoocccocccc🥥🥥🥥🥥c🥥🥥🥥🥥ooc🥥🥥🥥🥥 | |||
cooooocooocccoocccccooocoooocoooccoocoooocoooocccc | |||
occcccoccccccoo🥥🥥🥥🥥🥥🥥🥥🥥coccocccocc🥥🥥🥥🥥cooooocoococ | |||
oo🥥🥥🥥🥥cocccoccoo🥥🥥🥥🥥oc🥥🥥🥥🥥oocoooccccoocoo🥥🥥🥥🥥cccoc | |||
ooococccocccocccccoooocccc🥥🥥🥥🥥coocccooccccoocccooc | |||
o🥥🥥🥥🥥🥥🥥🥥🥥cooccccocccooccoocooc🥥🥥🥥🥥ccoooccooocooooo | |||
coccooocoocooooccooooccoooocc🥥🥥🥥🥥cocccc🥥🥥🥥🥥oococco | |||
occ🥥🥥🥥🥥cooocccocccoccoooccccooo🥥🥥🥥🥥ococcoocccooooc | |||
cooooocooccoo🥥🥥🥥🥥coccccooccoocooocooccoooocccooccc | |||
ooccccocccooocoocccoccoocccoocoocooccccooc🥥🥥🥥🥥cccc | |||
</pre> | |||
== Import text to Python == | |||
- local text | |||
<source lang=python> | |||
# read() as one big string | |||
filename = 'language.txt' | |||
txt = open(filename, 'r').read() # w (for writing) rw (read and write) | |||
print(txt) | |||
</source> | |||
- text with url, extract only the text from the etherpad -> url = 'https://pad.xpub.nl/p/archivefever<b>/export/txt</b>' | |||
<source lang=python> | |||
from urllib.request import urlopen | |||
#for ATATA | |||
url = 'https://pad.xpub.nl/p/ISSUE13_Atata_notes/export/txt' | |||
response = urlopen(url) | |||
lines = response.readlines() | |||
#for OTHERNESS | |||
url = 'https://pad.xpub.nl/p/Otherness_Daniel_L._Everett/export/txt' | |||
response = urlopen(url) | |||
liness = response.readlines() | |||
#for OTHERNESS | |||
url = 'https://pad.xpub.nl/p/Hope_Gurur_Ertem/export/txt' | |||
response = urlopen(url) | |||
linesss = response.readlines() | |||
#extract "what" in each of 3 text | |||
for line in lines: | |||
line = line.decode('UTF-8') | |||
if 'what' in line: | |||
print("found in ATATA, but where?") | |||
print(" --> " + line.replace('what', '*what*')) | |||
print() | |||
for line in lines: | |||
line = line.decode('UTF-8') | |||
if 'what' in line: | |||
print("found in Otherness, but where?") | |||
print(" --> " + line.replace('what', '*what*')) | |||
print() | |||
for line in lines: | |||
line = line.decode('UTF-8') | |||
if 'what' in line: | |||
print("found in Hope, but where?") | |||
print(" --> " + line.replace('what', '*what*')) | |||
print() | |||
</source> | |||
| |
Revision as of 22:33, 28 September 2020
Prototyping 1 (21/09/2020)
JupiterLab
- command language : pythone (also, wiki language. ex. instead of #, use ==headline==)
- run on offline + in browser (easy to publish)
- have its library, with ? at the end (ex. random?), we get its explanation
- with "enter", change the line in the cell
- "enter + shift", command to execute the command -> on the next line, spit out the output immediately (like javascript console)
- consist of "Console" and "Notebook"
Console
-like terminal, command line interface. direct way to see the result, but, cannot be saved
Notebook
- for hybrid publishing interface (but +, console)
- fast editing and publishing possiblle ( faster than using hub)
- Text (Markdown) + Code (Python)
- modifying / rerunning the cell is possible
Phython code
- https://docs.python.org/3/tutorial/classes.html#class-objects
- "17" + 29 -> error / "17" + "29" -> 1729
- x=x+1 same with x+=1
- type : str (for text ex. "17"), int(number), float(number with fractional parts), boolean(true/false), list
- calculation with text is not possible (sauf, * ex."hello"*2 -> hellohello)
- x=["a", "b", "c"] -> x[1]=b / x[-1]=c(negative number starts from the end)
- print() -> empty line output
- for For, the space before inner-command is important
for x in "Michael":
print(f"hello {x}")
print("End")
-> hello M
hello i
...
hello l
End # appeals only at the end
- input random
random.random -> 0.234546546678
random.randint(0,5) -> 4 (random number between 0-4)
random.randint(0,len(x)) -> 1 (number between 0-2)
random.choice(x) -> c
Generated poem
- A house of dust by Alison Knowles https://hub.xpub.nl/bootleglibrary/read/465/pdf
- My generated poem input and output
import random
from random import choice
ani = ("mosquitos", "pigs", "kangaroos", "tunas", "cats")
cha = ("blue", "laziest", "numbest", "most stinky", "dullest")
for x in range (10) :
n = random.randint(3, 30) # when the number is too big, doesn't give a sufficient random one (like, 99999 -> always, a number of 5 ciphers)
a = choice(ani)
c1 = choice(cha)
c2 = list(cha) # to remove an element in tuple, must change to list (list = ["",""], tuple = ("","")
c2.remove(c1) # c2 is a list except the result of c1
c2 = choice(c2)
print(f"Amongst the numbers of {n} of {a},")
print(f"the {c1} one and {c2} one are selected as the king and queen of {a}!")
print()
Amongst the numbers of 5 of mosquitos, the blue one and dullest one are selected as the king and queen of mosquitos! Amongst the numbers of 13 of cats, the laziest one and dullest one are selected as the king and queen of cats! Amongst the numbers of 12 of cats, the dullest one and most stinky one are selected as the king and queen of cats! Amongst the numbers of 11 of kangaroos, the numbest one and blue one are selected as the king and queen of kangaroos! Amongst the numbers of 7 of cats, the dullest one and blue one are selected as the king and queen of cats! Amongst the numbers of 26 of tunas, the laziest one and numbest one are selected as the king and queen of tunas! Amongst the numbers of 6 of tunas, the laziest one and dullest one are selected as the king and queen of tunas! Amongst the numbers of 13 of pigs, the numbest one and dullest one are selected as the king and queen of pigs! Amongst the numbers of 4 of kangaroos, the numbest one and blue one are selected as the king and queen of kangaroos! Amongst the numbers of 18 of pigs, the laziest one and blue one are selected as the king and queen of pigs!
Prototyping 2 (28/09/2020)
JupiterLab
Terminal
- Console where can test python language locally
- easily access to local file
type "python3" + enter #not the version 2.7! exit() #to finish
Phython code
- b=str(3) = c="3"
- "software" != "Software" (for Python, uppercase and lowercase are different string)
- a.replace ('soft','hard)
- a. + tab -> shows what we can chose after "."
- \(back slash) is used to escape characters
print('Euna's cookie') #Error, cause after a, is already closed
print('Euna\'s cookie') #output, Euna's cookie
a = "\\"
print(a) #output, \
Pattern
- Both early code and weaving pattern used punch card -> making pattern!
- Pattern 1
import random
characters = ['╱','╲'] #if you do with '/','\' use '/','\\'
width = 100
height = 50
line = ''
for y in range(height):
for x in range(width):
line += random.choice(characters)
print(line)
line = ''
╱╲╲╱╱╱╲╱╲╱╲╲╲╲╲╲╱╱╲╲╲╲╱╱╲╲╲╱╲╱╲╱╱╱╲╲╲╲╲╱╲╱╲╱╱╲╱╲╱╱ ╲╲╲╱╱╲╱╱╱╲╲╱╲╲╱╱╱╱╱╲╲╲╲╲╲╲╲╲╱╱╱╱╲╱╱╱╲╱╱╲╱╱╲╱╱╲╱╲╱╱ ╲╲╱╱╲╲╱╲╲╱╲╱╱╲╱╱╲╱╲╱╱╲╱╱╲╲╲╲╱╱╲╱╱╲╲╲╱╱╲╲╲╲╲╱╲╱╲╲╲╲ ╲╱╲╲╱╱╲╲╲╱╲╲╲╱╲╱╱╲╲╲╱╱╲╱╱╲╱╲╲╲╲╱╱╲╲╲╱╱╲╲╱╱╱╱╱╱╱╲╱╲ ╲╱╲╱╱╲╱╲╲╲╲╱╲╲╱╱╲╱╱╱╱╱╲╲╲╱╱╲╱╲╱╱╱╱╱╲╱╱╱╱╲╲╲╲╲╱╲╲╱╲ ╱╲╱╱╱╲╲╱╱╲╱╱╱╱╱╱╲╲╱╲╲╱╱╱╱╱╲╲╲╱╲╲╱╲╱╱╲╲╲╲╱╲╲╲╲╱╱╱╱╲ ╱╲╲╱╲╲╱╲╲╱╲╲╲╲╱╲╲╱╱╲╲╱╲╲╲╲╲╲╲╲╲╱╱╱╱╱╱╱╲╲╱╲╱╲╱╱╲╲╱╱ ╲╲╱╲╲╱╲╲╱╲╱╲╱╱╲╱╱╲╱╲╱╲╲╲╱╲╱╱╲╲╲╲╲╱╱╲╲╲╱╲╱╲╲╲╲╲╲╲╲╲ ╲╲╱╲╱╲╱╲╲╲╲╲╱╲╲╲╲╲╱╱╲╲╱╱╱╱╲╱╲╲╲╲╲╲╱╱╱╱╱╱╱╱╲╲╲╱╲╱╲╱ ╱╱╲╲╲╱╱╲╲╱╱╱╲╱╱╱╱╲╱╲╲╱╱╲╲╱╲╱╱╲╲╲╱╲╱╲╱╱╱╲╲╱╲╲╱╲╲╲╲╲ ╱╱╲╱╲╱╲╱╱╲╲╱╲╲╱╲╱╲╱╱╲╲╱╱╱╲╲╱╱╱╲╲╱╲╱╲╱╲╱╲╱╱╲╱╲╲╲╲╱╱ ╲╱╲╲╱╱╲╱╲╲╲╲╱╲╱╱╱╱╱╱╲╲╱╱╲╲╱╱╱╲╱╲╲╲╲╲╱╱╱╱╱╲╲╱╲╲╲╲╱╱ ╱╲╱╱╱╲╱╱╲╱╱╲╱╱╱╲╲╲╲╱╱╲╲╱╱╱╲╱╱╲╱╱╲╲╱╱╱╱╲╱╲╲╲╱╲╱╲╲╲╲ ╲╲╲╱╱╲╲╲╲╱╲╲╲╲╲╱╱╱╲╱╲╲╱╲╲╱╱╱╱╲╱╲╱╲╲╱╱╱╱╱╱╲╲╲╲╱╲╱╲╱ ╲╲╱╲╲╲╲╲╲╱╱╲╱╱╲╲╱╱╲╱╲╲╲╱╲╲╱╱╲╲╱╲╲╱╱╱╱╱╲╲╱╱╱╲╲╱╲╱╱╱ ╲╱╱╱╲╱╱╲╲╲╱╲╲╲╱╱╱╲╱╲╱╲╲╱╲╱╱╲╲╲╲╱╲╱╱╱╱╲╱╲╱╱╲╱╱╱╱╱╲╲ ╱╲╱╱╲╱╱╱╱╱╲╲╱╱╲╱╲╱╱╲╱╲╱╱╱╱╲╱╱╱╱╲╱╲╲╱╲╱╱╱╲╱╱╱╲╱╲╱╲╲ ╲╱╱╱╲╱╱╲╲╱╱╱╱╱╱╲╱╱╱╱╲╱╲╱╲╲╲╲╲╲╲╲╲╱╲╲╲╲╱╱╱╱╱╱╲╲╱╲╱╲ ╲╱╲╱╱╱╱╱╲╱╲╲╱╱╲╲╱╲╲╱╲╲╲╱╲╱╱╲╲╱╲╱╲╲╲╲╲╱╲╲╱╱╲╱╱╲╲╱╱╲ ╲╲╲╱╲╲╱╲╲╲╲╱╲╲╱╲╱╲╲╲╱╱╱╱╲╲╲╲╱╲╱╱╱╱╱╲╲╱╲╱╲╱╲╱╱╱╱╱╲╱ ╲╲╱╱╱╲╱╱╲╱╱╲╱╲╱╱╱╲╱╲╱╲╱╲╱╲╲╱╱╲╱╲╱╱╲╱╱╱╲╱╲╱╱╲╱╲╱╱╲╲ ╲╱╲╲╲╱╱╱╲╲╲╱╱╱╲╱╱╱╲╲╱╲╱╲╱╱╲╱╱╲╲╱╱╱╱╱╱╱╲╲╲╱╱╲╲╱╱╱╱╲ ╱╲╲╲╲╲╱╲╲╱╲╲╱╱╱╲╱╲╱╱╱╲╲╱╲╲╱╱╲╱╲╱╱╲╲╲╲╲╱╲╱╲╱╲╱╱╱╱╱╲ ╲╱╲╲╲╱╱╱╱╱╲╱╱╲╱╱╲╲╱╲╱╱╲╱╱╱╲╱╱╲╲╱╱╲╱╲╱╱╱╲╲╲╱╲╲╲╱╱╱╲ ╲╲╲╱╲╱╲╱╲╱╱╱╱╲╲╲╱╱╲╱╲╲╲╱╱╲╱╱╲╲╲╲╲╱╱╲╱╲╲╱╱╱╲╱╲╱╲╲╲╱
- Pattern 2
import random
characters = ["c", "o", "c", "o"]
width = 50
height = 25
line = ''
for y in range(height):
for x in range(width):
line += random.choice(characters) #chose the letter randomly
if 'coco' in line :
print(line.replace('coco','🥥🥥🥥🥥')) #coconut emoji if it's combination of coco
else :
print(line) #if not, just print the chosen letter
line = '' #reset, change the line
ccccoocoocoocoooc🥥🥥🥥🥥ococ🥥🥥🥥🥥cooocoo🥥🥥🥥🥥ococcooooc ooccooc🥥🥥🥥🥥occccccoooo🥥🥥🥥🥥c🥥🥥🥥🥥ccccoccooocc🥥🥥🥥🥥ccc coocooooooccoccc🥥🥥🥥🥥occoccc🥥🥥🥥🥥ccoc🥥🥥🥥🥥cooccooccoc 🥥🥥🥥🥥o🥥🥥🥥🥥occ🥥🥥🥥🥥ooocoocooocc🥥🥥🥥🥥ccoocoocccccccoooo coocoooccc🥥🥥🥥🥥ococcocc🥥🥥🥥🥥cooccoccccccocccoc🥥🥥🥥🥥cc oocc🥥🥥🥥🥥coooocooooocooooccoc🥥🥥🥥🥥coocc🥥🥥🥥🥥oooo🥥🥥🥥🥥o occoococc🥥🥥🥥🥥ccocccoo🥥🥥🥥🥥oocoocoo🥥🥥🥥🥥occoooooooooc ccccoooo🥥🥥🥥🥥oooccooooccoc🥥🥥🥥🥥ooooccccc🥥🥥🥥🥥cocccooc 🥥🥥🥥🥥cccccocccocccoccoo🥥🥥🥥🥥oooo🥥🥥🥥🥥ccooococ🥥🥥🥥🥥occo occoocccooo🥥🥥🥥🥥ooccoccoccoccoc🥥🥥🥥🥥occocccoc🥥🥥🥥🥥ooo c🥥🥥🥥🥥coccooocoooccooc🥥🥥🥥🥥occcoooooc🥥🥥🥥🥥ocooooooooc ooccooococcocccccoocoocc🥥🥥🥥🥥coccoocccooooocooocooo oo🥥🥥🥥🥥oocooccoccoccoccccoococcocccc🥥🥥🥥🥥oocoocooocc coooooc🥥🥥🥥🥥cooc🥥🥥🥥🥥🥥🥥🥥🥥coocooocoooocoococc🥥🥥🥥🥥ocoo oooccooc🥥🥥🥥🥥cocc🥥🥥🥥🥥oo🥥🥥🥥🥥ccooocccccccoococ🥥🥥🥥🥥cco cooo🥥🥥🥥🥥oococccoooocooccoocccocccc🥥🥥🥥🥥c🥥🥥🥥🥥ooc🥥🥥🥥🥥 cooooocooocccoocccccooocoooocoooccoocoooocoooocccc occcccoccccccoo🥥🥥🥥🥥🥥🥥🥥🥥coccocccocc🥥🥥🥥🥥cooooocoococ oo🥥🥥🥥🥥cocccoccoo🥥🥥🥥🥥oc🥥🥥🥥🥥oocoooccccoocoo🥥🥥🥥🥥cccoc ooococccocccocccccoooocccc🥥🥥🥥🥥coocccooccccoocccooc o🥥🥥🥥🥥🥥🥥🥥🥥cooccccocccooccoocooc🥥🥥🥥🥥ccoooccooocooooo coccooocoocooooccooooccoooocc🥥🥥🥥🥥cocccc🥥🥥🥥🥥oococco occ🥥🥥🥥🥥cooocccocccoccoooccccooo🥥🥥🥥🥥ococcoocccooooc cooooocooccoo🥥🥥🥥🥥coccccooccoocooocooccoooocccooccc ooccccocccooocoocccoccoocccoocoocooccccooc🥥🥥🥥🥥cccc
Import text to Python
- local text
# read() as one big string
filename = 'language.txt'
txt = open(filename, 'r').read() # w (for writing) rw (read and write)
print(txt)
- text with url, extract only the text from the etherpad -> url = 'https://pad.xpub.nl/p/archivefever/export/txt'
from urllib.request import urlopen
#for ATATA
url = 'https://pad.xpub.nl/p/ISSUE13_Atata_notes/export/txt'
response = urlopen(url)
lines = response.readlines()
#for OTHERNESS
url = 'https://pad.xpub.nl/p/Otherness_Daniel_L._Everett/export/txt'
response = urlopen(url)
liness = response.readlines()
#for OTHERNESS
url = 'https://pad.xpub.nl/p/Hope_Gurur_Ertem/export/txt'
response = urlopen(url)
linesss = response.readlines()
#extract "what" in each of 3 text
for line in lines:
line = line.decode('UTF-8')
if 'what' in line:
print("found in ATATA, but where?")
print(" --> " + line.replace('what', '*what*'))
print()
for line in lines:
line = line.decode('UTF-8')
if 'what' in line:
print("found in Otherness, but where?")
print(" --> " + line.replace('what', '*what*'))
print()
for line in lines:
line = line.decode('UTF-8')
if 'what' in line:
print("found in Hope, but where?")
print(" --> " + line.replace('what', '*what*'))
print()