Question: I want to store all the "o"'s printed by stdout.write function into a a variable which could be accesable any time

I have tried using len function to break loop once it reaches certain amount of strings, but no luck

```
import time
import sys

while True:
    sys.stdout.write("o")
    sys.stdout.flush()
    time.sleep(0.05)

```

Answer: 
Very simply, you can add them to a string, one at a time:

```
record = ""
while True:
    sys.stdout.write("o")
    sys.stdout.flush()
    record += 'o'
    time.sleep(0.05)

```

A slightly faster way is to count the quantity written, and then produce your desired string:

```
count = 0
while True:
    sys.stdout.write("o")
    sys.stdout.flush()
    count += 1
    time.sleep(0.05)
    # Insert your exit condition

record = 'o' * count

```
You could keep track of the number of O's in a separate variable:

```
number_of_os = 0

while True:
    sys.stdout.write("o")
    sys.stdout.flush()
    number_of_os += 1
    if number_of_os >= 100:
        break
    time.sleep(0.05)

```