|
Hi,
I am trying to understand a code in python:
what something similar to mystruct((0x03).to_byte(),'little') means?. trying to convert it to c.
|
|
|
|
|
You need to provide more details of the actual code you are referring to. Where is the definition of mystruct ?
|
|
|
|
|
please send the codes, i can learn from that
|
|
|
|
|
That's not how this works. The only code you're ever going to get is the code YOU write.
Nobody is going to do your work for you.
|
|
|
|
|
Dave Kreskowiak wrote: That's not how this works.
Yeah - he forgot to type in ALL CAPS, and missed the magic "ITS URGENTZ!!!!1!!" from the end of the "SEND TEH CODEZ NAO" demand.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
A walking, talking cliche.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
I wondered if I should spent the 5 minutes to direct the OP in the right direction, and yeah, he deserves it fully
Quote: What is Coding? “Writing code,” “coding,” and “programming” are basically interchangeable terms. Broadly speaking, knowing how to write code is the process of creating instructions that tell a computer what to do, and how to do it. Codes are written in various languages, such as JavaScript, C#, Python, and much more.
|
|
|
|
|
What is the difference between "C:\\my folder" and r"C:\my folder" in Python?
Can the "C:\\my folder" be written as r"C:\my folder"?
Thanks.
modified 12-Oct-23 13:00pm.
|
|
|
|
|
Unless an ‘r’ or ‘R’ prefix is present, escape sequences in strings are interpreted according to rules similar to those used by Standard C.
...
When an ‘r’ or ‘R’ prefix is present, a character following a backslash is included in the string without change, and all backslashes are left in the string.
Thus "C:\\folder" and r"C:\folder" represent the same string.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
Certainly! In Python, the difference between `"C:\\my folder"` and `r"C:\my folder"` lies in how they handle backslashes within strings:
1. **`"C:\\my folder"`:**
- This is a regular Python string where the backslash `\` is an escape character. When you use `\\`, it represents a single backslash in the resulting string.
- For example, `"C:\\my folder"` would be interpreted as `"C:\my folder"` when used in code.
2. **`r"C:\my folder"`:**
- The `r` prefix before the string denotes a raw string in Python. In a raw string, backslashes are treated as literal characters and are not interpreted as escape characters.
- So, `r"C:\my folder"` represents the string exactly as it is, including the backslash, and results in `"C:\my folder"`.
Yes, you can achieve the same result by using a raw string. Both `"C:\\my folder"` and `r"C:\my folder"` represent the same file path, but using a raw string often makes code more readable and avoids potential confusion with escape sequences.
|
|
|
|
|
Posting answers generated by an AI chatbot without clearly marking them as such will result in your account being closed.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I want to know which software you use for detecting AI generated content?
|
|
|
|
|
I use the most advanced pattern-recognition system ever developed: the human brain.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
# Gives the name of the game
print ("\t FLAMES")
print ("\n")
# Take input from user
# And Saved them in lowercase
name1 = input("Name of the first person : ").lower()
name2 = input("Name of the second person : ").lower()
print ("\n")
# If there any space in between names
# In this stage removing all the spaces
rename1 = name1.replace(" ", "")
rename2 = name2.replace(" ", "")
# Added those name
name = rename1 + rename2
# In here removing same characters
for x in name:
if name.count(x) != 1:
name = name.replace(x,"")
# Check total number of remaining characters
number = len(name)
# List of FLAMES acronym
result = ["Friends","Love","Affection","Marriage","Enemy","Siblings"]
while number > 1 :
split_result = (number % len(result) -1)
if split_result >= 0 :
right = result[split_result + 1:]
left = result[: split_result]
result = right + left
else:
result = result[: len(result) - 1]
print("Relationship status :", result[0])
#"split_result = (number % len(result) -1) " SHOWS THAT THERE IS ZERODIVITION ERROR HOW TO CORRECT THAT ?
|
|
|
|
|
The issue is with the loop at:
while number > 1 :
split_result = (number % len(result) -1)
if split_result >= 0 :
right = result[split_result + 1:]
left = result[: split_result]
result = right + left
else:
result = result[: len(result) - 1]
You never decrement the value of number so the loop will continue forever, or until some exception occurs. But it is not clear what the code inside the loop is supposed to do, so that also may need some reworking.
[edit]
Having looked again at this code I am not sure that the while statement above is correct. Try replacing it with if instead, thus:
if number > 1:
[/edit]
modified 8-Oct-23 4:23am.
|
|
|
|
|
Thank you so much for your help sir .... I understand what mistake was i done. In while loop I typed
" while number > 0: " that was the mistake i done. I changed that comment into " while len(reult) > 1:".
Now its okey sir. Thank you sir ,Thank you so much for your valuble time
|
|
|
|
|
I am trying to get the Coral M.2 card working with CPAI. This is on a new clean Windows build, where I followed the guidance referenced from this page Coral TPU really does its work for CP.AI object recognition! - Blue Iris
All seems OK with CPAI itself but I can't get the Coral module loaded - it throws these errors:
21:31:27:Error trying to start ObjectDetection (Coral) (objectdetection_coral_adapter.py)
21:31:27:An error occurred trying to start process 'C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\bin\windows\python37\venv\scripts\Python' with working directory 'C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral'. The system cannot find the file specified.
21:31:27: at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at CodeProject.AI.Server.Modules.ModuleProcessServices.StartProcess(ModuleConfig module)
21:31:27:Please check the CodeProject.AI installation completed successfully
The folder exists, but is empty. Have I missed a step in installation? What is the best way to fix this, please? Any advice would be much appreciated. Thanks.
|
|
|
|
|
|
OK, I will do. Apologies if this is the wrong place.
|
|
|
|
|
It's not so much that this is the wrong place. But there is a dedicated forum for the CodeProject AI system, and you are much more likely to get expert help there.
|
|
|
|
|
Hi folks,
I wrote a simple Python script to create programmatically Azure DevOps works items.
I spent not too much time until that worked.
But now I need a second task to full fill. I need to react programmatically to Azure DevOps events.
Even in the English Wiki page it is mentioned, that this is possible:
Azure DevOps Server - Wikipedia[^]
Quoting Wiki: >>>>> ... Another extensible mechanism is subscribing to system alerts: for example, alerts that a work item was changed, ... <<<<
In MSDN I found these articles:
Service hook consumers - Azure DevOps | Microsoft Learn[^]
Service hooks events - Azure DevOps | Microsoft Learn[^]
Since I am a little bit in hurry, and since I wonder, whether even a Python script on my Computer can contain such a call back function, which will be call in case of "work item has been modified"... I would appreciate any help....
Meaning: Helpful links, sample code and also the basic answer whether even such a Python script on my local computer can contain such a call back ?
May be it must a server site script ?
Any quick, good and helpful hints are really warmly welcome... many THX in advance
modified 6-Sep-23 15:38pm.
|
|
|
|
|
You can certainly use callbacks in Python, but that requires that the calling code is also written in Python*. I know nothing about Azure DevOps, but I would expect that is the system you need to investigate. So you need to check if it has Python support built in.
*not strictly true, if you use the C/C++ interface.
|
|
|
|
|
@Richard MacCutchan: Thanks for your super fast answer.
That Python itself offers such a callback mechanism is a well known fact.Therefore this reply is of no help for me.
Anyway many THX again, for your super fast answer.
Can some one help me… with the above issue… That would be great.
|
|
|
|