I starting teaching myself python and am stuck on trying to understand why I am not getting the output that I want. Long story short, I am using PDB for debugging and here my function in which I am having my issue:
I verified that my regex is correct(\d{5,6}.*&):
produces:
which is what I want, so when running pdb using steps and I get to:
and this is what I end up with as the output:
in which I should be seeing:
so it can be simply appended to:
producing:
I have been through several urls and cannot seem to figure out what I am doing wrong:
---------- Post updated at 04:37 PM ---------- Previous update was at 04:21 PM ----------
I made progress. The things you can find out by just reading:\
PHP Code:
re.search(pattern, string, flags=0)
Scan through string looking for a location where the regular expression pattern produces a match, and return a corresponding MatchObject instance. Return None if no position in the string matches the pattern; note that this is different from finding a zero-length match at some point in the string.
and
re.findall(pattern, string, flags=0)
Return all non-overlapping matches of pattern in string, as a list of strings. The string is scanned left-to-right, and matches are returned in the order found. If one or more groups are present in the pattern, return a list of groups; this will be a list of tuples if the pattern has more than one group. Empty matches are included in the result unless they touch the beginning of another match.
I was simply using the wrong function. I replaced re.search with re.findall and it worked partially.
How do I remove the brackets and single quotes to produce only:
??
---------- Post updated at 04:53 PM ---------- Previous update was at 04:37 PM ----------
It turned out the vidnum is part of a list and I needed to specify its place in the list, so:
Last edited by metallica1973; 03-06-2013 at 06:39 PM..
Hello
I have a big excel file for Ticket Data Analysis. The idea is to make meaningful insight from Resolution Field. Now as people write whatever they feel like while resolving the ticket it makes quite a task.
1. They may or may not tag it with something like below within the resolution... (1 Reply)
Here is a snippet of my code:
blahblahblah...
blah
for link in goodies.soup.find_all('a'):
blah.append(link.get('href'))
blah=list(set(blah))
which gives my list of urls. So now I use a regex to search for the relevant urls which I want in a list:
for r... (0 Replies)
Well, I'm a python noob and my last post here I was introduced to Regex. I thought this would be easy since I knew Regex with Bash. However, I've been banging my head a while to extract an ip address from ifconfig with this:
#!/usr/bin/python
import re
import subprocess
from subprocess... (5 Replies)
As a newbie to Python, I am trying to write a script in which is will add all the log files (*.log) from within a directory to a list, open the files and search for an ip using a regex and single it out (appending the ip's to the list). So far, I have:
import re, os
def list_files()
content = ... (4 Replies)
I setup Zoneminder and have been playing around with setting up a couple of Wanscam PTZ ip cameras in which I have been running into road blocks with streaming and etc. I cant find much information on the camera and its webserver that sits on it and wanted to get a an absolute directory structure... (5 Replies)
Hello,
Although I have found similar questions, I could not find
advice that could help with my problem. The issue:
I am trying to replace all occurrences of a regex, but
I cannot make the regex groups work together.
This is a simple input test file:
The Vedanta Philosophy... (3 Replies)
I have the below string and regex. However I cant understand why it works the way it does. IP has been changed for safety ;)
String = NowSMS Error Report. Error initializing SMSC Interface 'SMPP - 10.15.8.10:17600'. Interface is not available.
Regex = (.+\.)\s(.+)
I get two... (1 Reply)
Hello everyone,
Just started UNIX today! In our school we use solaris. I just want to know how do I setup Solaris 10 not the GUI one, the one where you have to type the commands like ECHO, ls, pwd, etc... I have windows xp and I also have vmware.
I hope I am not missing anything! :p (4 Replies)
I'm a newbie and want to learn a programming language, willy-nilly I picked python...
Should I go with 2.6.x which at first glance seems extremely well documented, or should I go with 3.0, which is new and shiny?!
I want...no...I'm going to NEED fantastic documentation or I'm going to fail... (2 Replies)
Hello,
I am trying to use the CDE File Manager in AIX to filter out files that I want to be hidden in the file manager. It gives me a script box that I can supposedly enter a regex into if I want to filter out additional file types.
Example: "Also Hide:"_______________
I can put... (0 Replies)