Skip to main content

All Questions

Tagged with
0 votes
4 answers
7k views

Python - Parsing JSON formatted text file with regex

I have a text file formatted like a JSON file however everything is on a single line (could be a MongoDB File). Could someone please point me in the direction of how I could extract values using a ...
iHaag's user avatar
  • 65
1 vote
1 answer
60 views

Python: read regexps from JSON

I have a JSON file where I store a mapping, which contains regexes, like the ones below: "F(\\d)": "field-\\\\1", "FLR[ ]*(\\w)": "floor-\\\\1", To comply with the standard I escape the backslashes, ...
Nikolay Derkach's user avatar
1 vote
1 answer
45 views

Extarct particulr part of json string using python regex

I have below json string: "{"sweep_enabled":true,"product":"XYZ","page":"XYZ Profile","list":" {\"id\":205782,\"name\":\"Robert Shriwas\",\"gender\":\"F\",\"practicing_since\":null,\"years\":21,\"...
Girish Gupta's user avatar
  • 1,293
0 votes
1 answer
47 views

Correcting to the correct URL

I have written a simple script to access JSON to get the keywords needed to be used for the URL. Below is the script that I have written: import urllib2 import json f1 = open('CatList.text', 'r') ...
windboy's user avatar
  • 133
0 votes
0 answers
74 views

how to save the response from the server in python?

input.txt: I am Hungry I am going home I am going to Germany complete code : """Represent a part in a multipart messsage""" def __init__(self, name, contentType, data, paramName=None): ...
sam 's user avatar
  • 203
5 votes
2 answers
2k views

How to replace values from JSON with those found by RegEx in a file using Python?

Lets say there's a file in the filesystem which contains values preprended with $. e.g. <ul> <li>Name: $name01</li> <li>Age: $age01</li> </ul> Am able to ...
PacificNW_Lover's user avatar
0 votes
1 answer
446 views

Decode regex into dictionary in Python

I have regex string in Python string I want to be able to decode the following string and map them into a dictionary But I can't figure out how to decode them out of unicode. Is there anyway to ...
user avatar
1 vote
2 answers
2k views

Parse JSON from html tag using Python

I've used BeautifulSoup to get the below snippet from an HTML page. I'm having trouble stripping out just the JSON (after FB_DATA). I'm guessing I need to use re.search, but I'm having trouble with ...
Randy's user avatar
  • 617
2 votes
2 answers
8k views

Parse JSON Object in python without the json library (Using only regex)

I'm currently building a small application using the Instagram API which replies with JSON "objects" for the GET operations. To get the response I'm currently using urllib2. This is part of an ...
selarom.epilef's user avatar
0 votes
1 answer
254 views

Delimiter issue with Scraping a JSON file from a LAN connection and parsing with json.loads()

I've scraped a json from a LAN connection but I am unable to parse it through json.loads. I'm trying to get all of the html from within the text lines, as you can see at the bottom. I get the ...
Ryflex's user avatar
  • 5,779
3 votes
3 answers
868 views

Using Multiline Regular Expressions in Python?

I am using regular expressions in Python to search through a page source, and find all the json information in the javascript. Specifically an example would look something like this: var fooData = { ...
jackcogdill's user avatar
  • 5,132