These are the same and either is fine to use.
output
I assumed that where your code says "with open('quote.txt', 'r') as quotes:" I am supposed to replace "quote.txt" with the actual name of the text file Yes you will need to replace with the actual text file you are using
In other words, the "while True:" part is right below the "with open('quote.txt', 'r')" with the same indentation.
Again without seeing relevant code it's hard to help. You may not even need the while loop.
The jython website says it only supports python2. Most use python3. The code I provided may not work.
from random import choice import random alist = [1,2,3,4,5,6,7,8,9] atuple = ['a','b','c','d','e'] print(f'import random module as whole -> {random.choice(alist)}') print(f'import just the choice function - > {choice(atuple)}')I looked at the jython website and it only supports python 2. Most python users will have python 3. The code I provided may not work.
output
Output:import random module as whole -> 8
import just the choice function - > e
I have not used jython so, I probably will not be much help with your code.I assumed that where your code says "with open('quote.txt', 'r') as quotes:" I am supposed to replace "quote.txt" with the actual name of the text file Yes you will need to replace with the actual text file you are using
In other words, the "while True:" part is right below the "with open('quote.txt', 'r')" with the same indentation.
Again without seeing relevant code it's hard to help. You may not even need the while loop.
The jython website says it only supports python2. Most use python3. The code I provided may not work.
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags