Answers for "how to write json files using pytohn"

11

write json pythonb

import json

data = {}
data['people'] = []
data['people'].append({
    'name': 'Scott',
    'website': 'stackabuse.com',
    'from': 'Nebraska'
})
data['people'].append({
    'name': 'Larry',
    'website': 'google.com',
    'from': 'Michigan'
})
data['people'].append({
    'name': 'Tim',
    'website': 'apple.com',
    'from': 'Alabama'
})

with open('data.txt', 'w') as outfile:
    json.dump(data, outfile)
Posted by: Guest on November-29-2019
0

create json file in python\

def check_splcharacter(test):
    # Make own character set and pass 
    # this as argument in compile method
 
    string_check= re.compile('[@_!#$%^&*()<>?/\|}{~:]')
 
    # Pass the string in search 
    # method of regex object.
 
    if(string_check.search(test) == None):
        print("String does not contain Special Characters.") 
    else: 
        print("String contains Special Characters.")
Posted by: Guest on June-10-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language