Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8037

General • Re: "Can't convert str to int' error writing to SD card

$
0
0
file.write("\n"+str(a)+" "+str(b)+" "+str(c)+" "+str(d)).
Glad it's working. An alternative to that, which some may prefer or find more pleasing to the eye is -

Code:

file.write("\n{} {} {} {}".format(a, b, c, d))
Or, as 'horuable' suggested, using 'format strings' -

Code:

file.write("\n{a} {b} {c} {d}")

Statistics: Posted by hippy — Tue Apr 01, 2025 7:44 pm



Viewing all articles
Browse latest Browse all 8037

Trending Articles