简体   繁体   中英

How can i send float values as post payload in aiohttp?

When i try to send a post request with one of the json in float, it shows

TypeError: Invalid variable type: mapping value should be str or int, got 77.5 ( 77.5 is the value which i want to send).

如第一条注释中指出的那样,通过将其转换为x = str(x)来将其值作为字符串发送

Try to convert it into float. Like x = float(x) . It worked for me because type of x in my code was numpy.float.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM