Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
print "Detections before NMS = {}".format(detections)
Produces:
SyntaxError: invalid syntax
detections = 10
print ("Detections before NMS = {}".format(detections))
Output:
Detections before NMS = 10
If you are using Python 3, print is a function and therefore needs brackets.
I suspect you are on Python 3, hence the syntax error.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I took a template file in terraform and I want to pass that variable in python, but throws an error each time I use.
{
'Name': 'tag:Name',
'Values': [value]
},
I want to pass the variable using this filter. Can someone help me with this?
you add the letter f before quotes and then use {} to display variables
i = 5
print(f"something {i}")
output: something 5
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
In python, I wrote a program to compare two strings.
The coedes are below
d = data.iloc[0]
cmpdate = d['quant_date']
print(cmpdate)
if (cmpdate=='2010-03-18'):
print("=================", dt)
else:
print("xxxxxxxxxxxxx", cmpdate)
the results are
2010-03-18
xxxxxxxxxxxxx 2010-03-18
tow strings are exactly same.
what is the problem?
TIA
Make sure you convert both of the dates to datetime format
and check the result
use to_datetime() function
This works fine
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I have error that say: the list index out of range ?
equal_score = []
for i, j in enumerate(new_gd):
if i > len(new_gd):
break
if new_gd[i]['score'] == new_gd[i+1]['score']:
equal_score.append(new_gd[i])
equal_score.append(new_gd[i+1])'
Since you refer to the index i+1 you should do if i+1 >= len(new_gd): break so you make sure i+1 exists.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I'm new to python. For a project at school, I have to make a sort of card game.
here is the code that I use:
playersDeckSize = deckSize / 2
i = 0
for i in range(int(playersDeckSize)):
playerDeck[i] = cards[random.randint(0, len(cards - 1))]
computerDeck[i] = cards[random.randint(0, len(cards - 1))]
i = i + 1
Your problem is in this expression:
len(cards - 1)
cards appears to be a list; you can't subtract 1 from a list. I suspect that you mean
len(cards) - 1
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I keep getting an error here, any help?
file = open(FILENAME,'r') is on the same line as file.close with no indentations. Why do I keep getting this error?
You forgot to close a parenthesis on this line:
ballpark = line.strip*(
it should probably be:
ballpark = line.strip()