简体   繁体   中英

How do I separate a single string containing to individual values

I have two strings the first is:

a = str(7.19% 8.16%)

and I would like to store this as two different strings as seen below:

b = str(7.19%) 
c = str(8.16%)

I have two strings the first is:

a = str(7.19% 8.16%)

and I would like to store this as two different strings as seen below:

b = str(7.19%) 
c = str(8.16%)

This is a one liner

a = '7.19% 8.16%'
b,c=a.split(' ')
print(b,c)

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