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 8 years ago.
Improve this question
I have a l̶i̶s̶t̶ string in Python
[Volume:vol-XXXXXXXX, Volume:vol-YYYYYYYY]
that I want to change to into JSON. The final result should be
{ volumes: ["Volume:vol-XXXXXXXX", "Volume:vol-YYYYYYYY"] };
I tried using json.dumps after changing it to a dict but for some reason it didn't work. How do I do something like this?
WHOOPS! The "list" I was talking about was actually a string :|. Guess I learned my lesson with a downvote storm!
Try this:
volumes = ["Volume:vol-XXXXXXXX", "Volume:vol-YYYYYYYY"]
json.dumps({
"volumes": volumes
})
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 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"]
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()
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.
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]
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).