So, I have this python file that generates a list of numbers and converts them into a string:
def gen():
array = []
for value in range(10):
array.append(value)
random.seed(20)
random.shuffle(array)
array_str = str(array)
array_str = array_str.strip('[]')
array_str = array_str + '.'
where there is a line in a HTML code in an HTML file elsewhere that runs the gen() function stated here.
However, when Transcrypt is run on that Python code, the array_str.strip('[]') part of the code doesn't seem to be converting well as the outer square brackets of the generated list [] is still seen on the webpage when I run the server. Is there a way to fix this?
It's simply not supported to use
.stripfor anything other than whitespace at the moment.Looking at the generated javascript code you can see Transcrypt runs:
with
.stripdefined asYou can try just removing the first and last characters as a workaround if the brackets are always at beginning and end (which I suppose they should be), something like this: