Trying to create JSON file same name as XML file and dump XML data into that using Python

```
import os
import json
import xmltodict

# Reading file from directory
with os.scandir('C:/jsonfile/') as entries:
    for entry in entries:
        name=(entry.name)  
        print(name)
        base = os.path.splitext(name)[0] #Getting name of the file
        f= open("C:/jjsonfile/"+base+".json","w+")
        with open("C:/jsonfile/"+name, 'r') as f: #Creating JSON file
            xmlString = f.read()
        jsonString = json.dumps(xmltodict.parse(xmlString), indent=4) 
        with open(f, 'w') as f: #Loading data into JSON file.
            f.write(jsonString)    

```

> 
> 1019586313.xml
> 
> 
> --------------------------------------------------------------------------- TypeError Traceback (most recent call
>  last) in 
>  13 xmlString = f.read()
>  14 jsonString = json.dumps(xmltodict.parse(xmlString), indent=4)
>  ---> 15 with open(f, 'w') as f:
>  16 f.write(jsonString)
>  17 
> 
> 
> TypeError: expected str, bytes or os.PathLike object, not
>  \_io.TextIOWrapper
> 
> 
>