Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

split multiple times

name_scr = 'alvinone-90,80,70,50|simonthree-99,80,70,90|theotwo-90,90,90,65'
test_scr = {}

for persinfo in name_scr.split('|'):
    name,scores = persinfo.split('-')
    test_scr[name] = map(int,scores.split(','))

print test_scr
Comment

PREVIOUS NEXT
Code Example
Python :: coronavirus tips 
Python :: migrate using other database django 
Python :: code for making an exe file for python 
Python :: python get news headlines 
Python :: how to code in python 
Python :: python wsgi server 
Python :: discord.py check if user has role 
Python :: flask migrate install 
Python :: Extract Date from Datetime object 
Python :: python datetime time in seconds 
Python :: make beep python 
Python :: how to change the datatype of a row in pandas 
Python :: all column except pandas 
Python :: python number guessing game 
Python :: download image python 
Python :: how to reapete the code in python 
Python :: loop through 2 dataframes at once 
Python :: python print return code of requests 
Python :: pandas read csv unnamed 0 
Python :: on member leave event in discord.py 
Python :: python ls 
Python :: write list of dicts to csv python 
Python :: python convert hex to binary 
Python :: how to find location using latitude and longitude in python dataframe 
Python :: TypeError: sequence item 0: expected str instance, int found 
Python :: cosine interpolation 
Python :: Parameter Grid python 
Python :: convert any base to decimal python 
Python :: get max value column pandas 
Python :: car in programming python 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =