Skip to content
murmot

Results for “python string array example program code error site:discuss.python.org data”

  • discuss.python.org

    Reading a CSV with data type specification. Error: cannot cast array...

    Discussions on Python.org. Reading a CSV with data type specification.Regarding this line of code, with “conversions” variable, I tried the str and ‘str’ options, insead of “string”, but this doesn’t change anything. Also, in this error message, it’s saying that the error is in the line 15.

  • discuss.python.org

    Serial read with python - Discussions on Python.org

    Jun 29, 2022 · Hi, Firstly I’m new with python. I’m trying to read values on the serial line to plot a graph. In my serial monitor putty everything is in the right way printed on the serial line. But when I’m trying to read it with python it adds an character and because of this the graph can not be plotted. Can someone help me out where this character comes from and how I can get rid of it? Kind ...

  • discuss.python.org

    PySerial not sending string to serial port of Arduino ...

    Oct 4, 2022 · The Arduino Uno has a code that is prepared to send a JSON object to its serial port when it catches a string “getData” on its serial port! So, my colleague asked me to write a script to automatically send this string and fetch the JSON object into a variable.

  • discuss.python.org

    How to get null terminated strings from a buffer? - Python Help...

    Do you have a small example that shows what you can so far? Once you have ctypes returning the array of 260 word (520 bytes) buffer to python you can decode it with buf.decode(‘utf-16’) and then look for ‘\0’ in the unicode string. I would be tempted to use.

  • discuss.python.org

    How to cast binary array to float array? - Python Help ...

    Feb 20, 2024 · Two functions that may be of help: Python documentation struct — Interpret bytes as packed binary data Source code: Lib/struct.py This module converts between Python values and C structs represented as Python bytes objects. Compact format strings describe the intended conversions to/from Python valu...

  • discuss.python.org

    TypeError: 'str' object is not callable - Python Help ...

    Aug 17, 2022 · Python has this nifty feature where an empty contianer is false, so this can be: ... this has the real benefit of working with any sequence (e.g. a tuple) rather than only a list. ... note the similarity on the code here – maybe you can remove some duplication? hint – the string .join () method could be helpful here.

  • discuss.python.org

    Add `!R` conversion to f-string and `str.format()` to format...

    I propose adding !R conversion format to f-string to format error messages and quote properly str subclasses.Otherwise, non-trivial code should be added in each project handling t-strings, like the repr_alt() function in this example: class StrSubclass(str): def __repr__(self)

  • discuss.python.org

    How to send and receive serial in python

    Aug 30, 2021 · I actually need to send Enter from python to Microcontroller, which is the return button from keyboard because Microcontroller is waiting to read string from python until Enter is pressed or send. while (EUSART1_Read () != 0x0d); What should I write in place of S in python ? ser.write (bytearray (‘S’,‘ascii’))

  • discuss.python.org

    How to get the error line? - Python Help - Discussions on ...

    Feb 9, 2024 · This is a good example of why it’s generally (frequently? sometimes? always?) a bad idea to catch exceptions within modules meant to be called by other people’s code. Unless the module code is going to re-raise it as a module-specific exception or knows it’s innocuous and safe to discard, it’s generally better to let the calling code handle it.