The append method it's not correct? [closed] - python

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
What the problem with my code ?
Please help
I tried several ide but still get same problem https://i.stack.imgur.com/KPRqA.jpg

Declare a=[] outside the for loop to get all your elements added to your list

What are you trying to do? We can't help if we don't know your end goal.
you can try putting a outside of the loop and set:
for i in range(0, x):
instead of just numbers in a parenthesis.

Related

Getting concrete attribute within a HTML span tag [closed]

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 3 months ago.
Improve this question
My problem:
I'm using beautiful SOAP in Python, and i want to know how do i get the concrete attribute such as "data-hk".
My code at the moment:
The output of the code is km/L, but i want the data about HK. How do i specifically select the right attribute within the span?
Many thanks in advance.
I tried the above code, and I've stated the result and output of it above.
Try this:
HK = cars.find("span", class_="variableDataColumn")["data-hk"]

How do I append an item to the list when the item is a parameter of a class and is found in another variable? [closed]

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 months ago.
Improve this question
Click here to see my code
I keep getting the error 'fellowship' is not defined. Why is this?
The variable fellowship is not defined when you try to create the hobbit fiction. Reverse the order of the books in cell 9.
Also dont use variable names like next which are Python keywords.
And your if-statement is not correct. If you want to check if sequel is of type Fiction use type or isinstance()

In python can I use comprehension in print just like in list? [closed]

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 want to ask that if we can use comprehension in print statement in python.
Just like:
print(i for i in range(10))
This gives me an error. Is there any way that we can compress our code by comprehensive printing ??
Your code has no error, it returns a generator. Instead, make it a list:
print([i for i in range(10)])
or better, with the list function:
print(list(range(10)))

numpy.ndarray is object is not callable in my case [closed]

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 am a new user for python and I know there are a few discussions about this; however, I still cannot fix it.
I execute my homework as the following code:
How to fix the error in my code? please advise, thanks!
Your ut variable is an array,
try to change (line 69)
u = lambda t,x : ut(t)
to
u = lambda t,x : ut[t]

can someone help me I can't get rid of that typeerror:'tuple' object is not callable [closed]

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 6 years ago.
Improve this question
screenshot
I don't know how to have the right thing, like whats descriped in the picture
thank you
You're trying to invoke the tuple pos as the function pos.
Instead, you want to index the tuples instead of calling them. So use pos[row][col] instead of pos(row,col).

Categories

Resources