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

Python • Re: Splitting values after comma and storing in different variables

$
0
0
Maybe use split like this

Code:

x='255,255'y=x.split(",")print (y)for z in y:  print (z)
Succesfully tested (leading and trailing spaces; 0)

Code:

x='255,255, 0, 155, 0 , 355'y=x.split(",")print (y)for z in y:  print (int(z))

Statistics: Posted by dbrion1 — Wed Jan 10, 2024 10:52 am



Viewing all articles
Browse latest Browse all 1312

Trending Articles