type-conversion

SQLite Database as type "dict"

SQLite Database as type "dict" Question: I am trying to create a quiz application. I have the module which asks the questions, shows the 4 possible answers in a listbox and then you click a button to fetch the result and check if true. My issue is trying to get the data type pulled from …

Total answers: 1

Convert bytes in string using python

Convert bytes in string using python Question: I have bson file, and i dont know what have inside of the document. I see the data type, and conclude the type of data is bytes. So, for undertsand the content the file, i need to save in readable formart. So, the firt step was convert my …

Total answers: 1

python string convert to datetime doesn't work

python string convert to datetime doesn't work Question: I’m trying to convert a string, I got from my program, to datetime.dateime but it doesn’t seem to work because I have the wrong format? The thing is, I have the right format… Here is some code: from datetime import datetime Timer = "27.10.2022 • 08:24:03" Timer …

Total answers: 1

ValueError: could not convert string to float: '8/3'

ValueError: could not convert string to float: '8/3' Question: I am having the folllowing instruction x1,y1,x2,y2,x3,y3,xp,yp = map(float, input().split()) When I am trying to execute it for a fractional value, e.g. 8/3, I get an error message. x1,y1,x2,y2,x3,y3,xp,yp = map(float, input().split()) 0.1 0.2 -8 -16.67 0 0.1 8/3 1 # output Traceback (most recent call …

Total answers: 2

convert byte to string represented with backslahes in python

convert byte to string represented with backslahes in python Question: I have a python byte object like a = b’1′ I want to convert to string like "\x31" is there any easy way to do this? Ultimately I have a byte object like my_obj = b’x00$x00x00x001.1.0.00x00x00x00x00x00x00x00x001.1.0.21152x00x00′ and I want it to have a string with …

Total answers: 1

Convert string dictionary in pandas.core.series.Series to dictionary in python

Convert string dictionary in pandas.core.series.Series to dictionary in python Question: I read my data from excel and saved it in data frame format. One of the columns of the data has data in a dictionary format(same shape but not dictionary format), which is recognized as a string format. So, I want to change the data …

Total answers: 1

Convert Hex string to Signed 16-bit integer big-endian Python

Convert Hex string to Signed 16-bit integer big-endian Python Question: I have a hex string as follows: "0d0d6e2800b900826bd000ba008a697800bc0094672000be009264c800bf0098627000c0009b601800c500c45dc000c600bf5b6800c700e2591000c800aa56b800c800ef546000c900b5520800ca00b84fb000ca00b74d5800cb00b84b0000cc00be48a800cc00ba465000cd00be43f800cd00bf41a000ce00c13f4800cf00c43cf000cf00c53a9800d000c3384000d000c935e800d100c6339000d100cb313800d200ca2ee000d300ca2c8800d300cc2a3000d300e227d800d400dd258000d400e0232800d600cd20d000d700cf1e7800d700d11c2000d700d519c800d800d4177000d800d6151800d800d412c000d800d6106800d800d70e1000d800d60bb800d800d3096000d800db070800d900d804b000d900db025800d800da000000d700da" I need to convert this to Signed 16-bit integer big-endian and get the values that can be seen when converted through this online converter https://www.scadacore.com/tools/programming-calculators/online-hex-converter/ I am getting the correct values for some values but not others …

Total answers: 2

0x%016llX from C to python?

0x%016llX from C to python? Question: I am using the following expression in C code: sprintf(message, "0x%016llX; ", someIntValue); How do I do the same in python? I know in C what it means. the mandatory % character a 0 flag for padding the 16 as "minimum field width" the ll as "length modifiers" the …

Total answers: 1

How to convert one str element from tuple to int value?

How to convert one str element from tuple to int value? Question: I have a tuple contains name, symbol, and number, for example: (‘albus dumbledore’, ‘>’, ‘3’) and I was trying to compare the number and other integer value from a list and I got an error message said ‘>’ not supported between instances of …

Total answers: 1